PDA

View Full Version : Can individual TreeNodes have their own drag group?



KallDrexx
21 Dec 2010, 7:19 PM
I have a TreePanel in my UI that has 4 different categories of child nodes, each type of node is a parent tree node containing children of that type. I want to give each type of child node it's own tree group. The business reason is that I want nodes of type A to be able to be dragged onto Grid X, but I don't want nodes of type B to be dragged onto Grid X.

From looking at the API, it seems like I can only assign a drag group to the whole tree, not to individual nodes. Is there a better way to go about this without tree groups?

countdown
22 Dec 2010, 1:24 AM
I don't know if this is possible, but you could still assign the same drag group to the tree and all grids, but then in the over and drop event, check some special properties of the nodes and return false! i.e. grid X checks in the dropover event, if the dragnode is of type A and returns true otherwise false!
I hope you get the idea.

Animal
22 Dec 2010, 2:12 AM
If I were you, I'd implement my own DragZone on a Tree which implements getDragData to grab node data and set up a proxy element. I don't really like the current DD implementation in TreePanel

Take a look at examples/dd/dragdropzones

KallDrexx
22 Dec 2010, 6:26 AM
Thanks for the replies. I had thought about checking the node type in the dropover event, but that seems like an issue from a UI perspective because the UI makes it seem like they can drop it on that node until they actually drop it.

Implementing my own DragZone does sound to be a better approach, thanks for the idea.