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

3 Answers 3

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
    });
}
Sign up to request clarification or add additional context in comments.

6 Comments

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).
what do you mean by number of input elements?
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.
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
@xero399 did you try $timeout or setTimeout?
|
4

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

Comments

-1

Maybe you can use $timeout for your issue

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

2 Comments

No thats not suitable solution
Indeed, timeout solutions are not reliable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.