|
131 | 131 |
|
132 | 132 | grid.api.registerEventsFromObject(publicApi.events);
|
133 | 133 | grid.api.registerMethodsFromObject(publicApi.methods);
|
134 |
| - |
| 134 | + |
135 | 135 | var processPagination = function( renderableRows ){
|
136 | 136 | if (grid.options.useExternalPagination || !grid.options.enablePagination) {
|
137 | 137 | return renderableRows;
|
138 | 138 | }
|
139 | 139 | //client side pagination
|
140 | 140 | var pageSize = parseInt(grid.options.paginationPageSize, 10);
|
141 | 141 | var currentPage = parseInt(grid.options.paginationCurrentPage, 10);
|
142 |
| - |
| 142 | + |
143 | 143 | var visibleRows = renderableRows.filter(function (row) { return row.visible; });
|
144 | 144 | grid.options.totalItems = visibleRows.length;
|
145 | 145 |
|
|
150 | 150 | }
|
151 | 151 | return visibleRows.slice(firstRow, firstRow + pageSize);
|
152 | 152 | };
|
153 |
| - |
| 153 | + |
154 | 154 | grid.registerRowsProcessor(processPagination, 900 );
|
155 | 155 |
|
156 | 156 | },
|
|
214 | 214 | if (gridUtil.isNullOrUndefined(gridOptions.paginationPageSize)) {
|
215 | 215 | if (gridOptions.paginationPageSizes.length > 0) {
|
216 | 216 | gridOptions.paginationPageSize = gridOptions.paginationPageSizes[0];
|
217 |
| - } else { |
| 217 | + } else { |
218 | 218 | gridOptions.paginationPageSize = 0;
|
219 | 219 | }
|
220 | 220 | }
|
|
254 | 254 | }
|
255 | 255 | }
|
256 | 256 | };
|
257 |
| - |
| 257 | + |
258 | 258 | return service;
|
259 | 259 | }
|
260 | 260 | ]);
|
|
343 | 343 | $scope.paginationApi = uiGridCtrl.grid.api.pagination;
|
344 | 344 | $scope.sizesLabel = i18nService.getSafeText('pagination.sizes');
|
345 | 345 | $scope.totalItemsLabel = i18nService.getSafeText('pagination.totalItems');
|
346 |
| - |
| 346 | + $scope.paginationOf = i18nService.getSafeText('pagination.of'); |
| 347 | + |
347 | 348 | var options = uiGridCtrl.grid.options;
|
348 |
| - |
| 349 | + |
349 | 350 | uiGridCtrl.grid.renderContainers.body.registerViewportAdjuster(function (adjustment) {
|
350 | 351 | adjustment.height = adjustment.height - gridUtil.elementHeight($elm);
|
351 | 352 | return adjustment;
|
352 | 353 | });
|
353 |
| - |
| 354 | + |
354 | 355 | var dataChangeDereg = uiGridCtrl.grid.registerDataChangeCallback(function (grid) {
|
355 | 356 | if (!grid.options.useExternalPagination) {
|
356 | 357 | grid.options.totalItems = grid.rows.length;
|
357 | 358 | }
|
358 | 359 | }, [uiGridConstants.dataChange.ROW]);
|
359 |
| - |
| 360 | + |
360 | 361 | $scope.$on('$destroy', dataChangeDereg);
|
361 | 362 |
|
362 | 363 | var setShowing = function () {
|
|
367 | 368 | var deregT = $scope.$watch('grid.options.totalItems + grid.options.paginationPageSize', setShowing);
|
368 | 369 |
|
369 | 370 | var deregP = $scope.$watch('grid.options.paginationCurrentPage + grid.options.paginationPageSize', function (newValues, oldValues) {
|
370 |
| - if (newValues === oldValues) { |
371 |
| - return; |
| 371 | + if (newValues === oldValues) { |
| 372 | + return; |
372 | 373 | }
|
373 | 374 |
|
374 | 375 | if (!angular.isNumber(options.paginationCurrentPage) || options.paginationCurrentPage < 1) {
|
|
398 | 399 | return options.data.length < 1;
|
399 | 400 | }
|
400 | 401 | };
|
401 |
| - |
| 402 | + |
402 | 403 | $scope.cantPageToLast = function () {
|
403 | 404 | if (options.totalItems > 0) {
|
404 | 405 | return $scope.cantPageForward();
|
405 | 406 | } else {
|
406 | 407 | return true;
|
407 | 408 | }
|
408 | 409 | };
|
409 |
| - |
| 410 | + |
410 | 411 | $scope.cantPageBackward = function () {
|
411 | 412 | return options.paginationCurrentPage <= 1;
|
412 | 413 | };
|
|
0 commit comments