ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

totalItems update does not work?

Open ghost opened this issue 11 years ago • 4 comments

Hello, I am using external pagination in angular's ui-grid as described here:

http://ui-grid.info/docs/#/tutorial/314_external_pagination

that updates a special field of totalItems when new page is arrived:

var getPage = function() {
// skipped some part
$http.get(url)
.success(function (data) {
  $scope.gridOptions.totalItems = 100;
  // updating grid object with data
});

};

My only difference to the standard example is that I have gridOptions inside an object that is passed to my directive, that has a grid inside it:

// Line is called right after I receive a page of data from server
$scope.gridObj.gridOptions.totalItems= response.TotalItems;

If I initialize this field before grid is shown on screen (together with configuration) then it remains at the value that I set back then (and obviously, it is not adequate to set of data I receive later, during runtime). But when I alter it later after I call my loading method (that returns current "page" as well as value for totalItems), the change is not picked up by ui-grid. If it is not initialized at startup, again, I could not set this to any value.

Please advice me how to modify successfully the totalItems parameter for the ui-grid during runtime. Can I possibly re-trigger some grid update manually?

P.S. This is also asked on Stack Overflow but gets no attention so far (http://stackoverflow.com/questions/32458127/updating-totalitems-in-angular-ui-grid-with-external-pagination). As there is a chance that this is some sort of minor bug, I think it fits the "issues" for the package.

ghost avatar Sep 09 '15 08:09 ghost

Did you set useExternalPagination: true in gridOptions?

nadav2511 avatar Sep 09 '15 09:09 nadav2511

Yes, I do, and pagination/sorting against server works fine. Just somehow update of field does not get through.

ghost avatar Sep 09 '15 09:09 ghost

The issue was likely not in ui-grid as more careful attention to configuration and initialization actually made everything work.

ghost avatar Sep 09 '15 10:09 ghost

What configuration and initialization were wrong, can you help me , As I am facing same issue, totalItems count is not updating and because of that page numbers are not visible.

jhaanji035 avatar Apr 23 '19 07:04 jhaanji035