PDA

View Full Version : Tree node selection example


pokermagic
05-11-2006, 02:32 PM
I'm trying to create a simple application where a tree is created by xml and then when a user selects on a node, a grid is populated based on that selection. I couldn't find out how to determine if a node is selected, which one and then fire an event for populating a grid. Is there an example out there or can someone point me in the right direction.

Thanks.

jstretch
05-15-2006, 12:09 PM
Untested, but you should get the idea.

someGrid.setDatapath(someTree.getSelection().datap ath);


something more flexible, once again, untested

//get pointer of current tree selection
var tmp_ptr = someTree.getSelection().datapath.dupePointer();

//move the pointer if needed
tmp_ptr.setXPath('some/other/relative/path');

//update the grid
someGrid.setDatapath(tmp_ptr.xpath);

pokermagic
05-15-2006, 02:02 PM
Thanks... I'll give that a try. One last question if you know... I have a multiple level tree, like


<tree>
<tree>
<tree>
</tree>
</tree>
</tree>


Do i put my selection method at the top most level to catch all the actions at the children level?