Expanding node programatically in case of Dynamic Loading

I am using Dynamic loading for displaying the tree. I have used tree.setXMLAutoLoading(url). My problem is i want to expand the node programatically. I tried using openItem(id) but it does not seem to work for nodes which have not been manually expanded atleast once. Since i am using dynamic loading, the entire tree data is not at the client side so in such a case how to expand a node programatically whose data does not reside at client side?



Thanks.

It possible If you know all chain of parent-child IDs
    tree.openItemsDynamic(list)

for example next command
    tree.openItemsDynamic(“1,1-2,1-2-sub”)
will do next
    a) open item with ID = 1
    b) wait while related XML loaded

    c) open child of loaded item with ID=1-2

    d) wait while related XML loaded

    e) open child of loaded item with ID=1-2-sub

so it can be used to open/show some items, which stored deep in hierarchy and not loaded on client side yet
( there is a special event onOpenDynamicEnd which fire when all ids in list loaded and opened - you can use it to catch that moment if necessary )


Thanks for such a prompt reply. But I am using dhtmlxTree Professional v1.4 (build 61218) and tree.openItemsDynamic(list) method does not exist in dhtmlXtree.js

I was able to locate openItemsDynamic in dhtmlXtree_xw.js file. But _stepOpen() method throws an error saying “XMLLoad is null or not an object”. I have a node A whose child nodes are not loaded at client side and i need to programatically open a child node of A say node A-1. So i am using openItemsDynamic(“A, A-1”) where A and A-1 are the ids of the node. Am i using the openItemsDynamic() method incorrectly?

After some debugging i figured out that i was giving a space after comma (,) in openItemsDynamic(list) and hence it was failing in my case. But i have fixed that and it does expand the node for me. I also want to highlight (or select) that node after expanding and hence i was using the following code snippet:
tree.openItemsDynamic(“A,A1”);
tree.selectItem(“A1”);
tree.focusItem(“A1”);
But this does not highlight the node for me. On debugging inside selectItem(‘A1’) i found that _globalIdStorageFind(‘A1’) method returns null for node A1 and hence it does not result in selection of A1. Due i need to trap some event like “ending of dynamic load” before executing the selectItem() method? The node A1 does appear expanded in the tree but it does not get highlighted.

Answered at
    dhtmlx.com/docs/products/kb/inde … ent&q=1708