angularjs ui-grid onRegisterApi event

VirtuoZ picture VirtuoZ · Dec 23, 2015 · Viewed 13.3k times · Source

can someone explain me what is purpose of gridApi in ui-grid and purpose of onRegisterApi event? And what is order of event when grid is rendering?

Answer

Tome Pejoski picture Tome Pejoski · Dec 23, 2015

Here's the docs, and here's a quick run-down:

GridApi provides the ability to register public methods events inside the grid and allow for other components to use the api via featureName.raise.methodName and featureName.on.eventName(function(args){}). To listen to events, you must add a callback to gridOptions.onRegisterApi

So basically you need to provide a callback for each of the events that you want to listen on.

About your second question, the order of events when the gird is rendering. The of events doesn't matter since in this phase you only register to the events that you want to handle.

Here are couple of examples that might help you understand: http://jsfiddle.net/user/relly/fiddles/