Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prasad Welekar on Mar 27, 2008 04:35
open dhtmlx forum
Event for afterInit

Hello Support,

We have afterInit tag in xml,which calls the method after Initialisation of Grid.
I just wonder if we have Event for after/before Initialisation of grid.
Thanks in Advance.



Answer posted by Support on Mar 27, 2008 05:17
There is no such event , in case of initializating by js script the moments when grid initialized is clearly visible without any events. When you loading configuration from XML - the onXLE event can be used ( it will fire after incoming XML fully processed )

Basically you can add you custom event with next trick

in js code

grid.my_event = function(){
   //any code here
}

in XML

<rows>
    <head>
       ....
    <afterInit>
       <call command="my_event"/>
    </afterInit>
Answer posted by Prasad Welekar on Mar 27, 2008 05:32
Thanks.
Actually I am not loading grid from xml, I used setValue method in  loop to set the value.
So the suggested  code is not useful in my case.
I want like this  mygrid.setOnAfterGridInit(callAfterGridInit);

 
Answer posted by Support on Mar 27, 2008 06:34
If you are using initialization from javascript, the key point is
    grid.init();
command, after it any operation will be instantly visualized


>>I want like this  mygrid.setOnAfterGridInit(callAfterGridInit);
There is no similar event , but it is pretty simple to add new one, you can locate init method in dhtmlxgrid.js and add as last line of it
    this.callEvent("onAfterGridInit",[])
and later use
    grid.attachEvent("onAfterGridInit",function(){
          //any custom code
    })