11@ngdoc overview
2- @name Tutorial: 314 External Paging
2+ @name Tutorial: 314 External Pagination
33@description
44
5- When paging is enabled, the data is displayed in pages that can be browsed using using the built in paging selector.
5+ When pagination is enabled, the data is displayed in pages that can be browsed using using the built in pagination selector.
66
7- For external paging , handle the `pagingChanged ' to load the page. Set the `gridOptions.totalItems' in the callback.
7+ For external pagination , handle the `paginationChanged ' to load the page. Set the `gridOptions.totalItems' in the callback.
88
99@example
10- This shows combined external paging and sorting.
10+ This shows combined external pagination and sorting.
1111<example module="app">
1212 <file name="app.js">
13- var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.paging ']);
13+ var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.pagination ']);
1414
1515 app.controller('MainCtrl', [
1616 '$scope', '$http', 'uiGridConstants', function($scope, $http, uiGridConstants) {
1717
18- var pagingOptions = {
18+ var paginationOptions = {
1919 pageNumber: 1,
2020 pageSize: 25,
2121 sort: null
2222 };
2323
2424 $scope.gridOptions = {
25- pagingPageSizes : [25, 50, 75],
26- pagingPageSize : 25,
27- useExternalPaging : true,
25+ paginationPageSizes : [25, 50, 75],
26+ paginationPageSize : 25,
27+ useExternalPagination : true,
2828 useExternalSorting: true,
2929 columnDefs: [
3030 { name: 'name' },
@@ -35,23 +35,23 @@ This shows combined external paging and sorting.
3535 $scope.gridApi = gridApi;
3636 $scope.gridApi.core.on.sortChanged($scope, function(grid, sortColumns) {
3737 if (sortColumns.length == 0) {
38- pagingOptions .sort = null;
38+ paginationOptions .sort = null;
3939 } else {
40- pagingOptions .sort = sortColumns[0].sort.direction;
40+ paginationOptions .sort = sortColumns[0].sort.direction;
4141 }
4242 getPage();
4343 });
44- gridApi.paging .on.pagingChanged ($scope, function (newPage, pageSize) {
45- pagingOptions .pageNumber = newPage;
46- pagingOptions .pageSize = pageSize;
44+ gridApi.pagination .on.paginationChanged ($scope, function (newPage, pageSize) {
45+ paginationOptions .pageNumber = newPage;
46+ paginationOptions .pageSize = pageSize;
4747 getPage();
4848 });
4949 }
5050 };
5151
5252 var getPage = function() {
5353 var url;
54- switch(pagingOptions .sort) {
54+ switch(paginationOptions .sort) {
5555 case uiGridConstants.ASC:
5656 url = '/data/100_ASC.json';
5757 break;
@@ -66,8 +66,8 @@ This shows combined external paging and sorting.
6666 $http.get(url)
6767 .success(function (data) {
6868 $scope.gridOptions.totalItems = 100;
69- var firstRow = (pagingOptions .pageNumber - 1) * pagingOptions .pageSize;
70- $scope.gridOptions.data = data.slice(firstRow, firstRow + pagingOptions .pageSize);
69+ var firstRow = (paginationOptions .pageNumber - 1) * paginationOptions .pageSize;
70+ $scope.gridOptions.data = data.slice(firstRow, firstRow + paginationOptions .pageSize);
7171 });
7272 };
7373
@@ -77,7 +77,7 @@ This shows combined external paging and sorting.
7777 </file>
7878 <file name="index.html">
7979 <div ng-controller="MainCtrl">
80- <div ui-grid="gridOptions" ui-grid-paging class="grid"></div>
80+ <div ui-grid="gridOptions" ui-grid-pagination class="grid"></div>
8181 </div>
8282 </file>
8383 <file name="main.css">
0 commit comments