I am not able to call refresh() on grid.
Can some on provide me some pointers on how we call refresh() method. Any examples?
Thanks.
2.x or 3.0?
I am using 3.0.0-rc.16
OK, look in the tutorials for some that do onRegisterApi.
Do that, and then call $scope.gridApi.core.refresh()
Thanks Paul for the response. I tried but that does not help.
$scope.gridOptions.onRegisterApi = function(gridApi){
//set gridApi on scope
$scope.gridApi = gridApi;
gridApi.selection.on.rowSelectionChanged($scope,function(row){
var msg = 'row selected ' + row.isSelected;
$log.log(msg);
});
gridApi.selection.on.rowSelectionChangedBatch($scope,function(rows){
var msg = 'rows changed ' + rows.length;
$log.log(msg);
});
};
$scope.gridApi.core.refresh();
But I am getting below error
Error: [jqLite:nosel] Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element http://errors.angularjs.org/1.2.25/jqLite/nosel at http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:78:12 at JQLite (http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:2375:13) at compile (http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:5966:25) at pre (http://localhost:8080/test/resources/js/lib/3.0.0-rc.16/ui-grid.js:859:30) at http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:7113:44 at nodeLinkFn (http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:6691:13) at compositeLinkFn (http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:6105:13) at publicLinkFn (http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:6001:30) at boundTranscludeFn (http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:6125:21) at controllersBoundTransclude (http://localhost:8080/test/resources/js/lib/angular-1.2.25/angular.js:6732:18)
The gridApi doesn't exist immediately, so if you call $scope.gridApi.core.refresh() immediately, it won't yet be instantiated.
Having said that, the error you have looks to have nothing to do with that. What is at line 859 of ui-grid.js in your build - what method is it in, of which module?
Also, tangentially, for what reason are you calling refresh? Perhaps there is a different way to achieve your outcome - in general you shouldn't need to call refresh manually.
Assuming that original issue is resolved, no comments for 3 weeks.
yes, it works! @PaulL1 thank u!
Hi, I am using the ui-grid and th eupdate of model does not update the grid (view). When I perform a sort it updates the data. How can I perform refresh in this case? Thanks in advance!
got it to work using gridApi.core.refresh() but is there a better way to achieve it?