For my AngularJS ui-grid, I implemented external pagination following the guidelines provided at this link:
In the process, I update the totalItems field whenever a new page is received:
var getPage = function() {
// skipped some part
$http.get(url)
.success(function (data) {
$scope.gridOptions.totalItems = 100;
// updating grid object with data
});
};
The only deviation from the standard example is that I keep the gridOptions inside an object passed to my directive, which contains a grid within it:
// This line is called immediately after receiving a page of data from the server
$scope.gridObj.gridOptions.totalItems= response.TotalItems;
If I initialize this field before the grid is displayed on screen along with the configuration, it retains the value set initially and does not reflect the data received during runtime. However, changing it after calling my loading method results in ui-grid not picking up the change. If left uninitialized at startup, I am unable to assign any value later on.
How can I successfully modify the totalItems parameter for the ui-grid during runtime? Is there a way to manually trigger a grid update?