hi, how would I cancel the drop?
i have this function:
PHP Code:
,InsertAppendMoveNode:function(e, id, text) {
var SuccessInsert = true;
//this is the variable I wanted to alter in my callback function
Ext.Ajax.request({
url : 'process-request.php',
method : 'POST',
timeout : 120000,
params : {
cmd:'InsertAppendMoveNode',
id:id,
point:e.point,
target:e.target.id,
text:text,
treeId:1,
treeTable:'tree'
},
success: function(response, request){
var result=Ext.util.JSON.decode(response.responseText).success;
switch(result){
case "true":
Ext.MessageBox.alert('Successful','Drag from grid and drop to teepanel is successful');
break;
default:
var errmsg = Ext.util.JSON.decode(response.responseText).error;
if (errmsg) {
Ext.Msg.show({
title:'Error insering new node',
msg: errmsg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
//how can I change value of my variable SuccessInsert which is declared outside EXt.Ajax request function
SuccessInsert = false;
}
break;
} //switch(result){
},
failure: function(response){
var result=response.responseText;
Ext.MessageBox.alert('failure',result);
//how can I change value of my variable SuccessInsert which is declared outside my EXt.Ajax request function
SuccessInsert = false;
},
callback:function(options,success,resp){
var result=Ext.decode(resp.responseText);
if(result.success)
//how can I change value of my variable SuccessInsert which is declared outside my callback function
SuccessInsert = true;
else
SuccessInsert = false;
}
});
//here it always return SuccessInsert true
return SuccessInsert;
}
Question: How can I change a value of SuccessInsert in my callback function? Or even in my success or failure function.
Thanks