Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing total item count #493

Closed

Conversation

alexspurling
Copy link

This fixes the "Total items: null" bug in this example: http://plnkr.co/edit/4LyAek?p=preview

I haven't committed the rebuilt files because when I do that it seems to introduce a bunch of \n to the compiled .js files. However I have run the e2e tests and tested the change locally. If you merge this request, make sure you rebuild the debug and prod libraries and commit the changes.

@AGiorgetti
Copy link

Yep, server side paging is not working well. I think you should also check the functions:
$scope.pageForward
$scope.cantPageForward
$scope.cantPageToLast

and use: $scope.pageOptions.totalServerItems there to do the check.
I think in this way the watch that looks for the totalServerItems can be removed.

Take this with good care, I just inspected the code and not tried it first hand yet.

@jafin
Copy link

jafin commented Jun 21, 2013

@alexspurling with your change I still got a total Items: null result. I get a NaN result for totalServerItems. Would it make sense to guard for this with something like the following (this is what I've had to do locally just to get a value)

var ret = Math.max(isNaN($scope.pagingOptions.totalServerItems) ? 0 : $scope.pagingOptions.totalServerItems, grid.data.length); 

I don't know the codebase at all so unsure of totalServerItems should always have value.

@jonricaurte jonricaurte mentioned this pull request Jun 28, 2013
@jonricaurte
Copy link
Contributor

The reason totalServerItems was removed from the paging options was: According to @timothyswt "we switched out the place where totalServerItems is set because people
wanted to update it manually while watching the pagingOptions configuration
variable for changes (so they know when to retrieve more data from the
server)." from #332. Here is an example on how to use it in the latest version:
http://plnkr.co/edit/50vJrs?p=preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants