Skip to main content

Multiple dojo tree on a page.

1 reply [Last post]
vikas_sharma
Offline
Joined: 2008-01-28
Points: 0

I have more than one dojo tree on a page. I am facing problem while adding nodes to a tree on expand event.

Code to addNode (glue.js):

jmaki.addGlueListener("/dojo/tree/sampletree/onExpand", function(args){
var node = {
label : 'New Node',
expanded : true,
children : [
{label : 'Node 1'},
{label : Node 2}
]

};
jmaki.publish("/dojo/tree/addNodes",{targetId : args.targetId, value : node});
});

This is adding node to all the trees on the page.

If i use below code, this will not add node to any of the tree.

jmaki.publish(("/dojo/tree/sampletree/addNodes",{targetId : args.targetId, value : node});

Thanks,
Vikas

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi,

Try adding different subscribe overrides on each tree.

You can say:

Then publish to the topic : "/tree1/addNodes" or "/tree2/addNodes" with the respective data.

You should also consider using the call jmaki.subscribe("/dojo/tree/sampletree/onExpand"...
instead of the addGlueListener which is deprecated.

Let me know if that doesn't work.

-G