PDA

View Full Version : tree 'nodedrop' event not getting fired when drag from grid and drop on tree!



adesai
20 Aug 2007, 8:52 PM
I

adesai
21 Aug 2007, 3:37 AM
I can achieve what I wanted with nodedragover and beforenodedrop events of tree.

But this only works when layout is not used. When I put grid and tree in west and center part of borderlayout now none of the tree events are getting fired! Some pointer please.

Actually what I want to achieve is highlight tree node and showing tooltip icon red/green depending upon my UI rules; when I drag over some row from grid to tree. Can anyone please help me out here?

When I use following code 'notifyOver' is getting fired immediately when I drag around anywhere in tree!


var drop = new Ext.dd.DropTarget(tree2.getEl(), {
ddGroup : 'GridDD',
notifyOver: function(dd, e, data) {
alert ('in notify over');
},
notifyDrop : function(dd, e, data){

if(!tree2.getSelectionModel().getSelectedNode()) {
Ext.MessageBox.show({
title: 'Subscriber Menu Action',
msg: 'Please select a node in tree first!',
width:300,
buttons: Ext.MessageBox.OK
});

return false;
}
var parent = tree2.getSelectionModel().getSelectedNode();

//find out if drop is allowed on this newly created node or not
if(!parent.attributes.allowDrop) {
//alert("Sorry this menu can not contain any other menus");
Ext.MessageBox.show({
title: 'Subscriber Menu Action',
msg: 'This menu can not contain any other menus',
width:300,
buttons: Ext.MessageBox.OK
});

return false;
}
//Go ahead and add new node to selected tree node

thejoker101
13 Sep 2007, 8:13 AM
Did you ever figure this out? I'm trying to do a grid drag and drop onto a tree in a borderlayout like yours (grid in the center and tree in the west), but I don't get a nodedrop event either.

Edit: Figured it out in 2.0, not sure if the fix works for 1.x which you might be using.

http://extjs.com/forum/showthread.php?goto=newpost&t=12912