Skip to content

Commit

Permalink
moving totalServerItems out of the pagingOptions
Browse files Browse the repository at this point in the history
this is for issue #161
  • Loading branch information
orneryd committed Apr 2, 2013
1 parent d33b642 commit 847d13e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 31 deletions.
17 changes: 9 additions & 8 deletions build/ng-grid.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 04/02/2013 00:44
* Compiled At: 04/02/2013 00:57
***********************************************/
(function(window, $) {
'use strict';
Expand Down Expand Up @@ -1133,7 +1133,7 @@ var ngEventProvider = function (grid, $scope, domUtilityService, $timeout) {

var ngFooter = function ($scope, grid) {
$scope.maxRows = function () {
var ret = Math.max($scope.pagingOptions.totalServerItems, grid.data.length);
var ret = Math.max(grid.config.totalServerItems, grid.data.length);
return ret;
};

Expand All @@ -1145,7 +1145,7 @@ var ngFooter = function ($scope, grid) {

$scope.pageForward = function() {
var page = $scope.pagingOptions.currentPage;
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
$scope.pagingOptions.currentPage = Math.min(page + 1, $scope.maxPages());
} else {
$scope.pagingOptions.currentPage++;
Expand All @@ -1169,15 +1169,15 @@ var ngFooter = function ($scope, grid) {
$scope.cantPageForward = function() {
var curPage = $scope.pagingOptions.currentPage;
var maxPages = $scope.maxPages();
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return !(curPage < maxPages);
} else {
return grid.data.length < 1;
}

};
$scope.cantPageToLast = function() {
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return $scope.cantPageForward();
} else {
return true;
Expand Down Expand Up @@ -1309,14 +1309,11 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
multiSelect: true,

// pagingOptions -

pagingOptions: {
// pageSizes: list of available page sizes.
pageSizes: [250, 500, 1000],
//pageSize: currently selected page size.
pageSize: 250,
//totalServerItems: Total items are on the server.
totalServerItems: 0,
//currentPage: the uhm... current page.
currentPage: 1
},
Expand Down Expand Up @@ -1366,6 +1363,10 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,

//Set the tab index of the Vieport.
tabIndex: -1,

//totalServerItems: Total items are on the server.
totalServerItems: 0,

/*Prevents the internal sorting from executing.
The sortInfo object will be updated with the sorting information so you can handle sorting (see sortInfo)*/
useExternalSorting: false,
Expand Down
12 changes: 6 additions & 6 deletions build/ng-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 04/02/2013 00:44
* Compiled At: 04/02/2013 00:57
***********************************************/
(function(window, $) {
'use strict';
Expand Down Expand Up @@ -1038,7 +1038,7 @@ var ngEventProvider = function (grid, $scope, domUtilityService, $timeout) {

var ngFooter = function ($scope, grid) {
$scope.maxRows = function () {
var ret = Math.max($scope.pagingOptions.totalServerItems, grid.data.length);
var ret = Math.max(grid.config.totalServerItems, grid.data.length);
return ret;
};
$scope.multiSelect = (grid.config.enableRowSelection && grid.config.multiSelect);
Expand All @@ -1049,7 +1049,7 @@ var ngFooter = function ($scope, grid) {

$scope.pageForward = function() {
var page = $scope.pagingOptions.currentPage;
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
$scope.pagingOptions.currentPage = Math.min(page + 1, $scope.maxPages());
} else {
$scope.pagingOptions.currentPage++;
Expand All @@ -1073,15 +1073,15 @@ var ngFooter = function ($scope, grid) {
$scope.cantPageForward = function() {
var curPage = $scope.pagingOptions.currentPage;
var maxPages = $scope.maxPages();
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return !(curPage < maxPages);
} else {
return grid.data.length < 1;
}

};
$scope.cantPageToLast = function() {
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return $scope.cantPageForward();
} else {
return true;
Expand Down Expand Up @@ -1138,7 +1138,6 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
pagingOptions: {
pageSizes: [250, 500, 1000],
pageSize: 250,
totalServerItems: 0,
currentPage: 1
},
pinSelectionCheckbox: false,
Expand All @@ -1155,6 +1154,7 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
showSelectionCheckbox: false,
sortInfo: {fields: [], columns: [], directions: [] },
tabIndex: -1,
totalServerItems: 0,
useExternalSorting: false,
i18n: 'en',
virtualizationThreshold: 50
Expand Down
2 changes: 1 addition & 1 deletion build/ng-grid.min.js

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions ng-grid-2.0.3.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 04/02/2013 00:44
* Compiled At: 04/02/2013 00:57
***********************************************/
(function(window, $) {
'use strict';
Expand Down Expand Up @@ -1133,7 +1133,7 @@ var ngEventProvider = function (grid, $scope, domUtilityService, $timeout) {

var ngFooter = function ($scope, grid) {
$scope.maxRows = function () {
var ret = Math.max($scope.pagingOptions.totalServerItems, grid.data.length);
var ret = Math.max(grid.config.totalServerItems, grid.data.length);
return ret;
};

Expand All @@ -1145,7 +1145,7 @@ var ngFooter = function ($scope, grid) {

$scope.pageForward = function() {
var page = $scope.pagingOptions.currentPage;
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
$scope.pagingOptions.currentPage = Math.min(page + 1, $scope.maxPages());
} else {
$scope.pagingOptions.currentPage++;
Expand All @@ -1169,15 +1169,15 @@ var ngFooter = function ($scope, grid) {
$scope.cantPageForward = function() {
var curPage = $scope.pagingOptions.currentPage;
var maxPages = $scope.maxPages();
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return !(curPage < maxPages);
} else {
return grid.data.length < 1;
}

};
$scope.cantPageToLast = function() {
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return $scope.cantPageForward();
} else {
return true;
Expand Down Expand Up @@ -1309,14 +1309,11 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
multiSelect: true,

// pagingOptions -

pagingOptions: {
// pageSizes: list of available page sizes.
pageSizes: [250, 500, 1000],
//pageSize: currently selected page size.
pageSize: 250,
//totalServerItems: Total items are on the server.
totalServerItems: 0,
//currentPage: the uhm... current page.
currentPage: 1
},
Expand Down Expand Up @@ -1366,6 +1363,10 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,

//Set the tab index of the Vieport.
tabIndex: -1,

//totalServerItems: Total items are on the server.
totalServerItems: 0,

/*Prevents the internal sorting from executing.
The sortInfo object will be updated with the sorting information so you can handle sorting (see sortInfo)*/
useExternalSorting: false,
Expand Down
2 changes: 1 addition & 1 deletion ng-grid-2.0.3.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/classes/footer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var ngFooter = function ($scope, grid) {
$scope.maxRows = function () {
var ret = Math.max($scope.pagingOptions.totalServerItems, grid.data.length);
var ret = Math.max(grid.config.totalServerItems, grid.data.length);
return ret;
};

Expand All @@ -12,7 +12,7 @@

$scope.pageForward = function() {
var page = $scope.pagingOptions.currentPage;
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
$scope.pagingOptions.currentPage = Math.min(page + 1, $scope.maxPages());
} else {
$scope.pagingOptions.currentPage++;
Expand All @@ -36,15 +36,15 @@
$scope.cantPageForward = function() {
var curPage = $scope.pagingOptions.currentPage;
var maxPages = $scope.maxPages();
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return !(curPage < maxPages);
} else {
return grid.data.length < 1;
}

};
$scope.cantPageToLast = function() {
if ($scope.pagingOptions.totalServerItems > 0) {
if (grid.config.totalServerItems > 0) {
return $scope.cantPageForward();
} else {
return true;
Expand Down
7 changes: 4 additions & 3 deletions src/classes/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,11 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
multiSelect: true,

// pagingOptions -

pagingOptions: {
// pageSizes: list of available page sizes.
pageSizes: [250, 500, 1000],
//pageSize: currently selected page size.
pageSize: 250,
//totalServerItems: Total items are on the server.
totalServerItems: 0,
//currentPage: the uhm... current page.
currentPage: 1
},
Expand Down Expand Up @@ -175,6 +172,10 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,

//Set the tab index of the Vieport.
tabIndex: -1,

//totalServerItems: Total items are on the server.
totalServerItems: 0,

/*Prevents the internal sorting from executing.
The sortInfo object will be updated with the sorting information so you can handle sorting (see sortInfo)*/
useExternalSorting: false,
Expand Down

0 comments on commit 847d13e

Please sign in to comment.