Login Register

Parent of Tree item

Hi all

This Probably is a very basic question, sorry.
I have a Tree(rootWidget) bound to an empty context menu (treeMenu), the context menu items/submenues are then created, dynamically according to the different tree nodes types with:
dojo.connect(treeMenu, "_openMyself", rootWidget, CreateDynMenu);

The CreateDynMenu is something like:

CreateDynMenu(e){

myNode = dijit.getEnclosingWidget(e.target).item;
...............
................
................
}
Where myNode.order is the 'Identifier' of the tree data.

My question is: How can I retrieve the item of the parent of myNode ?
I can see a method 'getItemParentIdentity' inside tree.js but I had no succeed to use it.

Can someone help me in this ?

Thanks very much for any help or direction !!

Trivial and Simple

It was in front of my eyes, I post this if some is searching for the same thing.

The response is :

myNode = dijit.getEnclosingWidget(e.target);
parent =getParent(myNode);

Always not clear within the documentation

Thanks taras, I tested without success this trivial solution ;-), and finally found the solution within the sources of "dndSource.js":

var childTreeNode = dijit.getEnclosingWidget(e.target); // where "e" is the parameter get by the bind call back function as you described
    childItem = childTreeNode.item;
    oldParentItem = childTreeNode.getParent().item;