Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Vikram on Dec 11, 2008 04:32
open dhtmlx forum
setLoadingStart and setLoadingEnd not working -Professional Edition

I have a licensed version of the grid api's and have included the dhtmlxgrid_deprecated.js as well.

However I am not able to invoke these 2 methods upon loading the grid.


summarygrid.setOnLoadingStart(show);
sumamrygrid.setOnLoadingEnd(stop);
summarygrid.loadXML("sample.xml");

where

function show()
{
    alert("loading....");
}

function stop()
{
    alert("loaded");
}

The idea is to load a progress bar(gif image) before the grid is loaded and remove them once the grid is loaded.
Answer posted by Support on Dec 11, 2008 07:15
Please check attached sample - it uses the same code and works correctly. 
If you are using dhtmlxgrid 1.6 - you may try to update dhtmlxgrid_deprecated.js with one from attached sample. 

With new syntax ( without deprecated methods ) , the same logic can be written as

summarygrid.attachEvent("onXLS",show); 
sumamrygrid.attachEvent("onXLE",stop);

Attachments (1)
Answer posted by Vikram on Dec 12, 2008 03:37
Hi,
 
       The piece of code that I have only fires the onXLE and not the onXLS. I was able to identify the glitch in my code after making a comparison with your code.I use loadXMLString to load the XML and not loadXML which I receive through an Ajax call and parse it through the loader response object.

       Is there a method that I can use to trigger the onXLS on a loadXMLString(basically to trigger an event before thr grid is displayed).
Answer posted by Support on Dec 12, 2008 04:59
This is expected behavior, onXLE works in sync mode, so it has not sense to fire separate event in such case. 
Because of sync. command processing your curent logic will not work in expected way. ( while alerts will be visible, if you replace them with some show|hide progress image then it will not work ) 
The correct way to show progress in such case is a next code 


grid.callEvent("onXLS",[]); //fire event manually
window.setTimeout(function(){ //fire loadXMLString through timeout to allow visual changes made in onXLS event
     grid.loadXMLString(....);
},1);
Answer posted by Vikram on Dec 12, 2008 23:20
With grid.callEvent("onXLS",[]) ,How do I need to add custom logic on the grid load(like loading the progress bar)?? I tried to stimulate with the above code.There seems to be no changes on the functionality.

And also the window.setTimeOut(....) code doesn't work in terms of loading the XMLString.The grid itself doesn't seem to get loaded on calling it from within the setTimeOut