I am using ngTable to load data from the API calls, the page always refreshing and data is showing on same page - which typically have 1000 or more records but since I have several api calls which are coming from the loop over, there could be 0 records or more from each of the calls which are pushed to the final $scope variable. Can you please add pagination to the calls, also when can I determine the loop is done in order to display the final noResultsFoundText found during the 0 records from all the calls. How to do update the pagination to display 10 records per page. Thank you for your help.
Here is the sample code-
` $scope.tableParams = new NgTableParams(
{
page: 1,
count: 10,
sorting: { sequence: "asc" }
}, {
counts: [25, 50, 75, 100],
total: 0,
getData: function (params) {
$scope.noResultsFoundText = false;
if (params.page() === 1)/*empty the checkboxes array only if it's a new search*/
$scope.checkboxes.items = {};
if ($scope.newSearch) {
$scope.newSearch = false;
$scope.clear = false;
$scope.submitted = false;
params.filter({});//Clear filters
$scope.loading = false;
angular.forEach($scope.registeredStudents, function (student) {
studentsDataSource.query({ searchData: $scope.searchData, registeredStudent: student }).$promise.then(function (errorCourses) {
$scope.errorCourses.push.apply($scope.errorCourses, errorCourses);
$scope.errorCourses = params.filter() ? $filter('filter')(errorCourses, params.filter()) : errorCourses;
$scope.errorCourses = params.sorting() ? $filter('orderBy')(errorCourses, params.orderBy()) : errorCourses;
params.page(1);//With every new search go to the first page
params.total(errorCourses.length);
$scope.errorCourses = errorCourses.slice((params.page() - 1) * params.count(), params.page() * params.count());
$scope.noResultsFoundText = $scope.errorCourses.length > 0 ? false : true;
});
});
return $scope.errorCourses`
I am using ngTable to load data from the API calls, the page always refreshing and data is showing on same page - which typically have 1000 or more records but since I have several api calls which are coming from the loop over, there could be 0 records or more from each of the calls which are pushed to the final $scope variable. Can you please add pagination to the calls, also when can I determine the loop is done in order to display the final noResultsFoundText found during the 0 records from all the calls. How to do update the pagination to display 10 records per page. Thank you for your help.
Here is the sample code- ` $scope.tableParams = new NgTableParams( { page: 1, count: 10, sorting: { sequence: "asc" } }, { counts: [25, 50, 75, 100], total: 0, getData: function (params) {