Max
Max

Reputation: 1334

Expand All Nodes on Lazyload in Jquery dynatree

I am using Dyna Tree plugin for tree view.

Now, while expanding the parent node I am using lazy load function,

onLazyRead: function(node){
    node.appendAjax({
    url: TREEVIEW_JSON_URL
    });
}

Now I would like to expand all the child and sub-child nodes those are available in my response with lazyLoad. In the current scenario I am able to expand only child nodes.

Please help me out on this. Thanks in advance

Upvotes: 1

Views: 5133

Answers (1)

mar10
mar10

Reputation: 14794

You could try something like this (haven't tested it though):

$("#tree").dynatree({
    […]
    onLazyRead: function(node){
        node.appendAjax({url: TREEVIEW_JSON_URL,
                         success: function(node) {
                             // Called after nodes have been created and the waiting icon was removed.
                             // now expand all children
                             node.visit(function(n){
                                 n.expand(true);
                                 });
                             }
                         });
    },
    […]
});

Upvotes: 7

Related Questions