Skip to content

Commit

Permalink
Quick fix: settings.total can be a function!
Browse files Browse the repository at this point in the history
related to the Sample esvit#14 Table with external control of data, when run alone it does not work: totalItems is assigned with settings.total, which in this case is a function; this causes numPages to be NaN.
  • Loading branch information
AGiorgetti committed May 22, 2014
1 parent 85fd295 commit 179ec28
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ app.factory('ngTableParams', ['$q', '$log', function ($q, $log) {
*/
this.generatePagesArray = function (currentPage, totalItems, pageSize) {
var maxBlocks, maxPage, maxPivotPages, minPage, numPages, pages;
if (angular.isFunction(totalItems))
totalItems = totalItems();
maxBlocks = 11;
pages = [];
numPages = Math.ceil(totalItems / pageSize);
Expand Down

0 comments on commit 179ec28

Please sign in to comment.