Issue 275: $.ui.dynatree.getNode(el) not working
Status:  Done
Owner: ----
Closed:  Oct 2013
Reported by muehl...@gmail.com, Jan 20, 2012
when using $.ui.dynatree.getNode(el); it will return undefined
Jan 20, 2012
Project Member #1 moo...@wwwendt.de
It works alt least *sometimes*:
    http://wwwendt.de/tech/dynatree/doc/sample-contextmenu.html#
so could you provide some details please.
Status: Waiting
Jul 17, 2012
#2 adb...@hotmail.com
Hi,

I am having a simular problem with nodes which have been cloned with true to maintain events etc. When the cloned elements are pasted into the tree thay look and behave fine but when I call GetNode from within a custom context menus function triggered via a right click on one of the cloned nodes I am getting null in return. When I call addchild() instead of cloning the problem does not occur. If I discover the issue I will try to post it.
Jul 17, 2012
Project Member #3 moo...@wwwendt.de
Dynatree adds a reference to the node object as 'dtnode' attribute to the generated <li> tags.
(The tree and nodes are stored as separate data structure, that is rendered on demand).

clone seems to ignore this dtnode attribute, which is a good thing: otherwise you would have 2 DOM elements that reference the same DynaTreeNode instance.
Jul 18, 2012
#4 adb...@hotmail.com
Thank you for you quick reply and explination. I can see that it is a good thing to not have two visible tree nodes point to one internal dynatree entity. I guess my thinking is that later when I insert the clone into the tree a new internal entity would be created and the dtnode property of the clone would point to the new dynatree entity. In my case when I paste the clone, after the operator selects another node at the same level, I use var jObj = $(sElem).after(tmpHTML); where sElem is the .closest("LI") of the selected node and tmpHTML is the clones html which I have reworked a bit.
I want to thank you for all your efforts in providing an excellent jQuery treeview plugin. I want to give special thanks to the author who posted the example of how to do inline editing of a dynatree node. I adopted the example and converted it to display a select box for the inner most level of my tree. This is really slick as it gives so much versility to the treeview - Thanks Al
Jul 18, 2012
#5 adb...@hotmail.com
Just a note. In the mix with all this I was trying to add a sibling node at the top level of my tree and I wanted it adjacent to the last top level node which was right clicked. This solved my problem. I had not previously seen the option on addchild to select the sibling till I looked at the code.

var dtnode = $.ui.dynatree.getNode(lastrightclickedelem);
	
var rootNode = $("#tree").dynatree("getRoot");

rootNode.addChild({title:"new title", icon: "my.ico"},dtnode);

Jul 26, 2012
#7 shassa...@gmail.com
Please use with older version of jQuery like 1.4.2 and getNode should work again...
Mar 28, 2013
#8 adb...@hotmail.com
The oldest jQuery version available for download is 1.6.3. Going backwards is really not an option given project policies. Is getNode fixed in the latest(1.2.4) version of dynatree? Will dynatree work with jQuery 1.9.1? All was fine till we went with jQuery 1.7.1 but there is no turning back.
Mar 31, 2013
Project Member #9 moo...@wwwendt.de
DT should work with the current releases of jQuery.
i am not aware of problems concerning getNode there. Please provide some details, if if it fails for you...
Oct 6, 2013
Project Member #10 moo...@wwwendt.de
Closing 'Waiting' issues without timely answer
Status: Done
May 2, 2014
Project Member #11 moo...@wwwendt.de
Cleanup Scrumboard
Labels: Milestone-Release2.0