[SOLVED][2.0]TreePanel beforenodedrop
I'd like to issue a message to the user that would conditionally affect whether the node drag is completed or reverted. I tried the following listener on my TreePanel, but it completes the drop as soon as the message is shown.
beforenodedrop : function ( dropEvent ){
//Fires when a DD object is dropped on a node in this tree for preprocessing.
// Return false to cancel the drop. The dropEvent passed to handlers has the following properties:
// * tree - The TreePanel
// * target - The node being targeted for the drop
// * data - The drag data from the drag source
// * point - The point of the drop - append, above or below
// * source - The drag source
// * rawEvent - Raw mouse event
// * dropNode - Drop node(s) provided by the source OR you can supply node(s) to be inserted by setting them on this object.
// * cancel - Set this to true to cancel the drop.
sourceText = dropEvent.dropNode.text;
sourceType = dropEvent.dropNode.attributes.iconCls.substr(5);
sourceID = dropEvent.dropNode.id;
destText = dropEvent.target.text;
destType = dropEvent.target.attributes.iconCls.substr(5);
destID = dropEvent.target.id;
return Ext.Msg.show({
title : 'Please confirm',
msg : 'Really move ' + sourceText + ' to the ' + destText + ' ' + destType + '?',
minWidth : 140,
buttons : Ext.Msg.OKCANCEL,
icon : Ext.MessageBox.WARNING,
fn : function(btn){
if(btn === 'ok'){
api.body.mask('Saving');
Ext.Ajax.request({
url : 'Common/Ajax/json.aspx?req=dragTree&sourceID='+sourceID+'&destID='+destID,
success : function(response) {
// show the confirmed message
api.body.mask('Saved!');
setTimeout(function(){
api.body.unmask();
}, 250);
},
failure:function(response) {
// show the failure message
}
});
}
return false;
}
});
}
Does anyone see what I'm doing wrong?
Thanks,
Joshua
Any ideas?
return Ext.Msg.show({
always returns an Ext.MessageBox which will never evaluate to FALSE.
The drawback is that you will have to do everything that comes afterwards manually because the automatic drop handling will be terminated after an unsuccessful "beforenodedrop".
#If you have any other info about this subject , Please add it free.# |

