hi, i have the following code in my xml document:
this is placed within the head tag
on my tree i then have the following code:
testTree = new dhtmlXGridObject(‘testGrid’);
testTree.selMultiRows = true;
testTree.enableResizing(“true”);
testTree.imgURL = “…/dhtmlxTreeGrid/imgs/”;
testTree.setSkin(“light”);
testTree.enableDragAndDrop(false);
testTree.loadXML("…/XML_Docs/EnterDetails.xml");
// code to set up the grid correctly
testTree.onLoadCalls=function()
{
alert("");
setAllTreeRowsWhite(testTree);
testTree.expandAll();
}
i have placed the alert in the function ensure it was going in correctly but i have noticed that it is calling the function before it has loaded any data therefore the expandall() function is working as it has nothing to expand yet. this is strange as i have the afterinit working properly on other interfaces
thanks very much
richard
In case of loading configuration from XML the order of commands is next
- commands from beforeInit section executed
- configuration from head loaded
- grid.init called
- commands from afterInit section executed
- rows data loaded
So, while afterInit executed after grid.init, it still before data loaded in grid.
Because javascript is single-threaded you can use
testTree.onLoadCalls=function()
{
window.setTimeout(function(){
alert("");
setAllTreeRowsWhite(testTree);
testTree.expandAll();
},1);
}
The code will be called exactly after all data loaded
thanks very much
hi, on doing this the alert box is showing but i am getting an error message:
why would this error occur?
thanks
Such error occurs when call@command attribute has some value which not reffer to any existing grid method.
Please be sure that value of “command” attribute has related grid method for all call tags.