Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by tree_user on May 14, 2008 15:22
open dhtmlx forum
Preselect Checkboxs which are already selected and stored in DB

Hi,

User select a particular child node(checkbox) and that will be stored in the DB. When the user comes back to the tree, the selected child node,parent node and root node should be preselected and the tree should be in opened and visible (collapsed mode).

Please let me know how to accomplish this. Help will be appreciated.

Thanks in advance.
Answer posted by Support on May 15, 2008 04:25
You may define selected|opened nodes in XML
<tree id="0">
    <item id="some1" selected="true" open="1">  

selected attribute force selection of item after XML loading
open attribute force item opening after loading

or make the same effect by JS code

tree.selectItem(id);   //force selection
tree.openItem(id);   //force opening
tree.focusItem(id);   //adjust scrollbars so item will be visible for sure

   
Answer posted on May 15, 2008 16:07

Hi,

Thank you very much for the reply. It worked.

But i noticed a strange behavoir. I have downloaded 1.6 standard version.

After loading the xmltree many times (approx 15 times), the tree not displaying at all. I don't see any error.

I clearted the cache,temp folder,restarted the server it didn't work.

This is what i did to get it work:

1. Loaded the old versions of (working) dhtmltree.js and dhtmlcommon.js, test.jsp(which loads the tree) . Tested.

2. Then loaded the new version 16 dhtmltree.js and dhtmlcommon.js, test.jsp(which loads the tree) and it worked this time.

This is strange. any idea?

 

 

 

Answer posted by Support on May 16, 2008 02:30

Not sure, the problem may be caused by some caching effect.

If problem occurs only in IE - you can try to use
          tree.enableIEImageFix(true)
it will resolve problem with image caching in IE which can cause some weird problems.

If problem still occurs for you - please provide any kind of sample where problem can be reconstructed ( you can send it directly to mailto:support@dhtmlx.com )

Answer posted on May 16, 2008 07:50
Thanks for the reply.