mayan
mayan

Reputation: 161

How can I remove a class from a treenode while dragging?

I have a dynamically populated Ext.tree.TreePanel. I can drag nodes from the tree and drop them in a panel but when I drag them, the nodes default iconclass also appears in the drag proxy. How do I remove that class?

Upvotes: 0

Views: 825

Answers (1)

Sean Adkinson
Sean Adkinson

Reputation: 8605

I haven't tested this, but just looking through some of the source code, the dragged ghost is obtained via an TreeNode element clone, so you can't tell it explicitly not to add your class, but the first chance you get to delete the class is in the TreePanel.startdrag event:

removeClassOnStartDrag = function(tree) {
    tree.dragZone.proxy.ghost.removeClass('some-class');
}

...

treepanel.on('startdrag', removeClassOnStartDrag, this);

Upvotes: 2

Related Questions