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?
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
andfeatureName.on.eventName(function(args){})
. To listen to events, you must add a callback togridOptions.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/