Initially, the paging feature was working perfectly when data was loaded. However, after implementing the enteredValue/search functionality to populate ng-grid, I encountered issues where only 5 items per page were displaying and the next/previous buttons were not functioning properly. It seems that changing the data in gridOptions from 'myData' to 'source' may have caused this pagination problem. I am currently attempting to pass $scope.source into the setPagingData function but facing challenges. How can I resolve this issue and ensure proper pagination behavior?
$scope.setPagingData = function(data, page, pageSize) {
var pagedData = data.slice((page - 1) * pageSize, page * pageSize);
$scope.myData = pagedData;
$scope.totalServerItems = data.length;
if (!$scope.$$phase) {
$scope.$apply();
}
};
$scope.gridOptions = {
data: 'source',
enablePaging: true,
pagingOptions: $scope.pagingOptions,
showFooter: true
};
For a live demonstration, check out this Plunker link.