DigitalSkyline
13 Jun 2007, 3:32 PM
Hello,
I would like advice on how to best use the TreeEditor class - I need to do server-side processing prior to committing an edit. I see it flowing something like this:
- select a node
- edit node text
- Ajax communication with server, server returns either true/false to allow the edit
- if true, commit the text change, else revert
However it seems that I will only be able to send the request, and the text will be changed regardless of the server response due to the Asynchronous nature of the application.
I would also like to know if its possible to trigger the editor by a means other then the default selected node-click (for ex. via a context menu).
Your assistance is much appreciated as always! :)
treeEditor = new Ext.tree.TreeEditor(stree, {
autosize : true,
ignoreNoChange : true
});
treeEditor.on("beforestartedit",
function(o,target,text){
var n = sm.getSelectedNode();
// validate some stuff to make sure a correct node is chosen
if (n.id!='exp-main' && !n.attributes.allow) {
return true;
} else {
return false;
};
}
);
treeEditor.on("beforecomplete",
function(o,newText,oldText){
if (newText.length>0) {
// make an ajax call to the server specifying the changes
} else {
msg("Oops!",'Invalid Name Specified.');
o.cancelEdit();
return false;
};
}
);
I would like advice on how to best use the TreeEditor class - I need to do server-side processing prior to committing an edit. I see it flowing something like this:
- select a node
- edit node text
- Ajax communication with server, server returns either true/false to allow the edit
- if true, commit the text change, else revert
However it seems that I will only be able to send the request, and the text will be changed regardless of the server response due to the Asynchronous nature of the application.
I would also like to know if its possible to trigger the editor by a means other then the default selected node-click (for ex. via a context menu).
Your assistance is much appreciated as always! :)
treeEditor = new Ext.tree.TreeEditor(stree, {
autosize : true,
ignoreNoChange : true
});
treeEditor.on("beforestartedit",
function(o,target,text){
var n = sm.getSelectedNode();
// validate some stuff to make sure a correct node is chosen
if (n.id!='exp-main' && !n.attributes.allow) {
return true;
} else {
return false;
};
}
);
treeEditor.on("beforecomplete",
function(o,newText,oldText){
if (newText.length>0) {
// make an ajax call to the server specifying the changes
} else {
msg("Oops!",'Invalid Name Specified.');
o.cancelEdit();
return false;
};
}
);