PDA

View Full Version : Dragging disabled tree nodes (resolved)



para
1 May 2007, 12:19 PM
Currently trees do not allow for dragging of tree nodes.
I cannot find where this is defined. In my application I'd like to be able to drag them. I already have modified code to allow for the clicking of disabled nodes.
Anyone have a quick answer as to where it is in the code?

tryanDLS
1 May 2007, 1:03 PM
Did you look at the 'two trees' example? There are also a number of threads regarding DnD in trees.

para
1 May 2007, 1:10 PM
Yes, I have seen the two-trees example. However, that is simply drag and drop stuff.
I am looking for the actual function the disallows the dragging of disabled nodes.

tryanDLS
1 May 2007, 1:18 PM
TreeDragZone.onBeforeDrag checks whether a node is draggable and enabled - this is probably a good place to start investigating if you want to change behavior.

para
9 May 2007, 8:06 AM
I finally got back to working on this.
I realized that I was overwriting the function incorrectly.
This code will allow the dragging of disabled nodes.


if(Ext.tree.TreeDragZone.prototype) {
Ext.tree.TreeDragZone.prototype.onBeforeDrag = function(data, e){
return data.node && data.node.draggable;
};
}

jsakalos
9 May 2007, 8:08 AM
Look for Ext.override() method. This is useful in adding/overriding of methods of classes.

para
9 May 2007, 8:21 AM
very cool. thanks.


Ext.override(Ext.tree.TreeDragZone, {
onBeforeDrag: function(data, e) {
return data.node && data.node.draggable;
}
});