Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Reneta Säll on Dec 21, 2007 05:15
open dhtmlx forum
dhtmlxTree multiselection on load

Hi,
I need to implement multiselection when the tree content is loaded from DB, I am using open and select parameters when creating the XML data as:
<item call="" id="erajapn" im0="blank.gif"
im1="blank.gif" im2="blank.gif" imheight="4px"
imwidth="4px" open="erajapn" select="erajapn"
style="font-style: italic" text=""ABCD/>
<item call="" id="ebcikzz" im0="blank.gif"
im1="blank.gif" im2="blank.gif" imheight="4px"
imwidth="4px" open="ebcikzz" select="ebcikzz"
style="font-style: italic" text="DEFH"/>
I have tree.enableMultiselection(true);
When the data is transmited to the client, is just one selection(the second item) is done in the tree content.
How can I have multiselection on the client side?
Answer posted by Support on Dec 21, 2007 09:31
In case of selection from XML - only one item can be selected, you can use some kind of workaround
<tree id="0">
    <userdata name="selected">erajapn,ebcikzz,erajapn</name>
    <item ....


And in js code

    tree.loadXML("data.xml",function(){
       var ids=tree.getUserData(0,"selected").split(",");
       for (var i=0; i<ids.length; i++)
          tree.selectItem(ids[i],false,true)
    });