Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 317
Derek Avatar asked Feb 03 '15 12:02

Derek


1 Answers

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.

like image 198
mainguy Avatar answered Sep 26 '22 03:09

mainguy