setCheck() method on dynamic loaded tree

Hi all,
sometimes I have to check tree elements that have not been “expanded”.
Think about dynamic loaded tree.
This is common on big tree and sometimes is not so simple to recursively open parent nodes.

Is there a way to:

  1. Load all tree
  2. Automatically expand the path to the checked elements?

thanks in advance

Hello

sometimes I have to check tree elements that have not been “expanded”.

You can use setCheck method to check a certain item.

Think about dynamic loaded tree.

In case of dynamic loading you can check the items after branch is open:
tree.attachEvent(“onXLE”,function(tree,itemId){
/your code here/
})

Or you can pass ids of items that should be checked to the server (you should modify the autoloading path in this case - XMLsource property)

tree.attachEvent(“onXLS”,function(tree,id){
tree.XMLsource = url+"?check="+list_of_ids;
return true
})

This seems to be the only solution.
can you give me an example of list_ids ?

Thank you in advance.

it is possible to define checked state in the xml:
<item checked=“1” …>

So you can pass the list with ids of items that must be checked. And set checked attributes for items with these ids.

tree.XMLsource = url+"?check=id1,id2,id3";