View Full Version : Tree Panel: Add Child(folder) then add grandchild(leaf) to that child folder

28 Feb 2012, 4:12 PM
I'm working with a tree panel that has the drag & drop plugin configured in it's view.

When a user clicks a button, I've successfully added a new, "non-leaf" type node to my root node using appendChild({}). Next, I have another button that adds a new "leaf"type node. Now I have two different types of node, both children of the root node.

What I'd like is for the new "leaf"type node to be created with in the last "non-leaf" type node that's been added. Also, I would like to constrict the "non-leaf" type nodes to only be able to be dropped into the 1st children (folders). In other words, I don't want leaf nodes to be able to be dropped to the root node. I want to allow leaf drops to the other non-leaf nodes

Is this achievable?

28 Feb 2012, 5:55 PM
You should keep track of the last non-leaf node created so that when you create a leaf it will go to that tracked non-leaf node.