Derek
Derek

Reputation: 3355

Cannot use InfiniteScroll feature of ui-grid

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?

Upvotes: 7

Views: 5573

Answers (1)

mainguy
mainguy

Reputation: 8331

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.

Upvotes: 16

Related Questions