Callback function for Angular ui-grid rendered
Asked Answered
O

3

10

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()

Ogata answered 1/4, 2016 at 9:39 Comment(0)
O
4

The figured out the function is $scope.gridApi.core.on.rowsRendered()

Ogata answered 1/4, 2016 at 10:15 Comment(0)
L
7

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
    });
}
Lichi answered 24/3, 2017 at 13:45 Comment(6)
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 renderedLevkas
@Levkas did you try $timeout or setTimeout?Lichi
@SanjayNishad Thanks! putting the timeout inside the renderingComplete without setting time works fine!Levkas
O
4

The figured out the function is $scope.gridApi.core.on.rowsRendered()

Ogata answered 1/4, 2016 at 10:15 Comment(0)
A
-1

Maybe you can use $timeout for your issue

http://jsfiddle.net/8nuwQ/100/

Apoplectic answered 1/4, 2016 at 9:59 Comment(2)
No thats not suitable solutionOgata
Indeed, timeout solutions are not reliable.Wynd

© 2022 - 2024 — McMap. All rights reserved.