Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by M. Zielenski on May 14, 2008 00:10
open dhtmlx forum
dhtmlxgridobject

Hi,

1.)
how do I expand all subitems of all items in my treegrid. The code below does not work:
2.)
How can I select rows after loadxml? I want to store the selection in a database. When the user return to the from, I want to show the selection again.
Thanks
Marc

mygridzu = new dhtmlXGridObject('gridboxzu');
        mygridzu.imgURL = "treegrid/dhtmlxGrid/codebase/imgs/icons_greenfolders/";
        mygridzu.setHeader("Header 1");
        mygridzu.setInitWidths("*");
        mygridzu.setColAlign("left");
        mygridzu.setColTypes("tree");
        mygridzu.setColSorting("str");
        mygridzu.enableMultiselect("true");
        mygridzu.init();
        mygridzu.loadXML("cc.cgi");    
        mygridzu.expandAll();    
Answer posted by Support on May 14, 2008 03:55
>> mygridzu.loadXML("cc.cgi");    
>> mygridzu.expandAll();   

The XML loading is async, so if you want to call any action against treegrid you need to wait while XML loaded. It can be done by using onXLE event, or by using second parameter of loadXML command

mygridzu.loadXML("cc.cgi",function(){
            mygridzu.expandAll();
})

>>How can I select rows after loadxml? I want to store the selection in a database.
You can select row by js command
mygridzu.loadXML("cc.cgi",function(){
            mygridzu.expandAll();
            mygridzu.selectRow(index);
})

or do it directly from XML

<row id="some" selected="true" ....