Extjs treepanel: how to drop a node on leaf nodes

Sergio Morstabilini picture Sergio Morstabilini · Dec 3, 2010 · Viewed 7.6k times · Source

Does anybody know how to enable drag and drop onto leaf nodes of a treepanel?

My scenario is exactly like this one: http://dev.sencha.com/deploy/dev/examples/tree/reorder.html but I need also to append items to leaf nodes.

Thanks

Answer

Jeff Trull picture Jeff Trull · Dec 4, 2010

I presume the OP wants to know if a leaf node can have an item dropped on it and thus become non-leaf (the item becomes its child). I also find that the example does not support this...

Update: the following post on the Sencha forums addresses this issue directly:

http://www.sencha.com/forum/showthread.php?17522-2.0rc1-2.0.1-TreePanel-Dropping-onto-a-Leaf-Node/page2

I applied the suggestion (mark nodes without children "expanded" and "loaded"), and I find that Ext will use the "leaf" icon, but still allow you to drop things on it. When the user drops an item onto such a node, the icon changes to a folder. The "leaf" config option will prevent a node from ever having items dropped onto it.