tags:

views:

11

answers:

0

I have multiple -- for this discussion, assume two -- dijit.trees, all guaranteed to have identical topology. The first tree is the master; all the others are slaves. I want to:

1) Hide the expando +/- thiny on all the slaves, so that only the master has expand/collapse controls. 2) Make the behavior of the slaves trees mimic the behavior of the master tree. If you open the root of the master, the root of all slave trees should open too, and similarly for all other non-leaf nodes.

I'm accomplishing #1 at the moment by: A) Using openOnClick="false" on all of the slave trees (it's "true" for the master) B) Wrapping all the slaves in a: ... C) Wrapping each tree in a: ... D) Adding a to each tree that looks, relative to that tree's , for an tag that has class "dijitTreeExpando", and which is enclosed by a . Where I find this, I'm changing the class to "dojoCantRecognizeThisClass". Don't ask me why this works, but it disrupts something in the dijit.tree internals, and makes the expando disappear, which is what I want.

dojo.forEach( dojo.query('span[class="slave_class"] * img.dijitTreeExpando', dojo.byId("treespan_id_mytree_00")), function (x) { dojo.attr(x, "class", "dojoCantRecognizeThisClass"); } );

I'm okay with this for the moment, but it's clearly an ugly hack and I'm afraid it won't be compatible with a solution for #2...

#2 has me stumped. I'm populating the trees with JSON returned by a CGI query.

dijit generates all the internals. I can dojo.connect() an onOpen() handler (one for onClose() would also be needed, and analogous)...

for (i in evt) { console.log(i + ": " + evt[i]); }

...and see all the details of the JSON related to the relevant node of the master tree when I click on its expando. But I don't see how to get a grip on the corresponding individual tree nodes in my slave tree(s), so I can force them to open or close as necessary to stay in lockstep with the master tree. Firebug shows me that digit.tree() is generating lots of tag id values in there. Nothing in these generated IDs matches my JSON. dijit is making it all up on it's own. I can't figure out how to cross-reference successfully.

I suspect that once I get such a handle, I'll need to use handle.attr('path', [something]) to manipulate the slaves, but I haven't got that figured out either.

This data is all being delivered via Ajax, so I'm trying to do it exclusively via markup rather than programatically.

Any pointers would really be appreciated. This is my first time using Dojo. I feel like I'm in way over my head.