PDA

View Full Version : Change the path of a TreeNode



tobi
28 Jun 2007, 11:57 PM
Hello,
So, I use the TreePanel/TreeNode/TreeEditor to show the folder's structure from the server, and I use the getPath() fn to send the information about the folder/node to the php.
It's okay and it works. But when I rename a node (folder) in the tree, and I change the id as well, the path doesn't change. Why?
I would like to send the old and new name of the node/folder (it is okay) and the full path, but the getPath() fn return with the old path... or this fn not use the id property?

Thanks if anyone can help, and sorry about my English.

Animal
29 Jun 2007, 12:01 AM
Editing the visible text won't change the node's id.

tobi
2 Jul 2007, 4:18 AM
Yes I know, but I change the id of the node (I think):
Here is the code
I register an observer for my TreeEditor
this._treeEditor.on('complete',this.saveFolder,this);
and the fn:


...
saveFolder: function(editor,value,startValue){
// change the id of the node... or not?
editor.editNode.id = value;
Ext.Ajax.request({
url: live_site + '/administrator/index.php?ctrl=Images&cmd=saveFolder',
params: {
// I would like to send the path of the node,
// but I will get it with the old id.
path: editor.editNode.getPath(),
newName: value,
oldName: startValue || null
},
method: 'post',
callback: this.saveResultProcess,
scope: this
});
}
...


So the getPath fn return with an old path, not with the new id's path. Or it is the correct way?
And when I check it with FireBug, it shows: the id has changed correctly.

tobi
6 Jul 2007, 1:27 PM
Ok, maybe it is not a realy good solution, but I change the old node with a new one
That works.