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()
3 Answers
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
});
}
6 Comments
Hola Soy Edu Feliz Navidad
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).
Sanjay Nishad
what do you mean by number of input elements?
Hola Soy Edu Feliz Navidad
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.xero399
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
Sanjay Nishad
@xero399 did you try
$timeout or setTimeout? |
Maybe you can use $timeout for your issue
2 Comments
user3048027
No thats not suitable solution
Hola Soy Edu Feliz Navidad
Indeed, timeout solutions are not reliable.