PDA

View Full Version : Tree update sort on rename node



para
27 Apr 2007, 8:46 AM
Hey guys, I was wondering if there was a better way to do this.
When I rename a node (using my code) in a tree, it doesn't re-sort. I was looking for an appropriate event to fire, but was unable to do so.
Anyways, I ended up doing this (and its working fine). I'm wondering if there's a better/cleaner way to do it.



function renameNode(node) {
Ext.MessageBox.prompt('Rename', 'New name for \"' + node.text + '\"', function(btn, text){
if (btn == 'ok'){
var a = node;
node.setText(text);
node.ownerTree.fireEvent('beforechildrenrendered', node.parentNode);
}
});
}


The only 3 events that cause a re-sort are append, insert, and beforechildrenrendered.