Server side pagination of AngularJS ng-grid -
i trying implement server side pagination example of ng-grid mentioned here http://angular-ui.github.io/ng-grid/ . unfortunately, not quite understand code.
here situation: 1. have page has 2 text boxes , button. post values of these 2 text boxes web service on ng-click of button. returned json should displayed grid. code in plunker http://plnkr.co/edit/50vjrs?p=preview
$scope.getpageddataasync = function (pagesize, page, searchtext) { settimeout(function () { var data; if (searchtext) { var ft = searchtext.tolowercase(); $http.get('largeload.json').success(function (largeload) { data = largeload.filter(function(item) { return json.stringify(item).tolowercase().indexof(ft) != -1; }); $scope.setpagingdata(data,page,pagesize); }); } else { $http.get('largeload.json').success(function (largeload) { $scope.setpagingdata(largeload,page,pagesize); }); } }, 100); };
will render grid on page load (which not want). dont understand how associate $scope.getpageddataasync function ng-click?
- the html code doesnt have textbox searching through grid though in controller have $scope.filteroptions. how search happening in plunker code?
wish there more documentation on site.
thank you
in plunker, function quoted in question invoked:
$scope.getpageddataasync($scope.pagingoptions.pagesize, $scope.pagingoptions.currentpage);
does commenting out line have desired effect?
as filter, it's there convenience can add filter text field yourself. defined in object can use custom directive or ng-include block.
Comments
Post a Comment