Cannot use InfiniteScroll feature of ui-grid
Asked Answered
C

1

7

Trying to use, without success, infinite scrolling feature of ui-grid.

Both 3.0.0-v16 and current unstable script version (released 2 days ago) were used. I'm following the example of http://ui-grid.info/docs/#/tutorial/212_infinite_scroll .

When ui-grid calls $scope.gridOptions.onRegisterApi(gridApi) method, the injected gridApi object does not have a infiniteScroll member.

Indeed, the following line

gridApi.infiniteScroll.on.needLoadMoreData($scope, function () {...});

raises

TypeError: Cannot read property 'on' of undefined
at Object.$scope.gridOptions.onRegisterApi (http://...my-ctrl.js:144:35)
at Grid.renderingComplete (http://ui-grid.info/release/ui-grid-unstable.js:4791:20)

Do you know what's wrong?

Calliope answered 3/2, 2015 at 12:13 Comment(0)
L
16

Not really an answer! I just use this for better code formating.

Did you write the html like this:

<div ui-grid="gridOptions" class="grid" ui-grid-infinite-scroll></div>

and did you inject the feature in your app?

var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.infiniteScroll']);

Please remember that ui-grid is in development and those clever guys are working hard and have issues with keeping the documentation up to date.

Lecythus answered 3/2, 2015 at 12:35 Comment(2)
Thanks! I was missing the ui-grid-infinite-scroll directive. As a personal thought, I consider 'by-the-example' ui-grid doc pedagogy especially poor.Calliope
Same problem for me also. I missed 'ui.grid.infiniteScroll' injectionHelicograph

© 2022 - 2024 — McMap. All rights reserved.