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

Updated to use pagingOptions.totalServerItems #505

Closed
wants to merge 1 commit into from
Closed

Updated to use pagingOptions.totalServerItems #505

wants to merge 1 commit into from

Conversation

Siyfion
Copy link

@Siyfion Siyfion commented Jun 24, 2013

No description provided.

@sonnyhu
Copy link

sonnyhu commented Jun 25, 2013

If using this fix, $scope.$parent.$watch(options.totalServerItems, function (newTotal, oldTotal) won't work. It watches gridOptions.totalServerItems. My solution is that keep the ng-grid source code, and add this code to the controller.

$scope.tempTotal = 0; // tempTotal will be set in an async call.
$scope.totalServerItems = 0; // This will be set in $watch when gridOptions.totalServerItems has changed.
$scope.gridOptions = {
    // If gridOptions.totalServerItems maps to a string, $watch will update its value.
    totalServerItems: 'tempTotal'; 
}

@Siyfion
Copy link
Author

Siyfion commented Jun 25, 2013

@sonnyhu I don't think you've understood my reasoning for this change.

Currently there is a bug with the way $scope.gridOptions.totalServerItems = data.count works, causing the value displayed on the grid to be null. This change is a proposed solution, if the documentation's method of setting the totalServerItems variable is correct. If it isn't correct, then this change is ignored and a bug-fix is needed.

Either way, if you wish to discuss this, please discuss on the actual issue in question (#504).

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

As said in the other one, "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. I'll update the documentation and use the latest version of 2.0.7

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.

3 participants