I want to know what is the callback function that fires after Angularjs grid is rendered meaning all its cells are rendered a function like $.ready()
Callback function for Angular ui-grid rendered
Asked Answered
The figured out the function is $scope.gridApi.core.on.rowsRendered()
there are two functions
you can use, if you want to execute on ui-grid ready then use renderingComplete
onRegisterApi: function(gridApi) {
gridApi.core.on.renderingComplete($scope, function() {
//code to execute
});
}
if you need callback
on data change use rowsRendered
onRegisterApi: function(gridApi) {
gridApi.core.on.rowsRendered($scope, function() {
//code to execute
});
}
These functions are almost what I want, however they don't still work properly. If I check the number of input elements using these function I get 0, however it should show the right value (in my case I have 12). –
Wynd
what do you mean by number of input elements? –
Lichi
I mean that if I use
jQuery('input').length
(these inputs are supposed to be inside the grid cells) I receive "0". But if I do it with a timeout (solution that I don't like) it shows me 12, therefore the grid is not 100% rendered at this point. –
Wynd same problem here. I need to apply filters on columns after the grid is rendered. If I do the renderingComplete() and inside I try to access the columns list, it is empty cause grid it's not rendered –
Levkas
@Levkas did you try
$timeout
or setTimeout
? –
Lichi @SanjayNishad Thanks! putting the timeout inside the renderingComplete without setting time works fine! –
Levkas
The figured out the function is $scope.gridApi.core.on.rowsRendered()
Maybe you can use $timeout
for your issue
No thats not suitable solution –
Ogata
Indeed, timeout solutions are not reliable. –
Wynd
© 2022 - 2024 — McMap. All rights reserved.