Hi, I have today some problem with Tree. To be correct, I'm using it quite long time, but for every sync, I'm removing all elements and adding new elemens to tree, this is without problems:)
But I have component, where I'm sorting items by name ( getLabel() ) and if I rename something, I need to remove it from tree and add to different place. This is very common and easy, but I'm doing something wrong. (I looking forward tree in 0.8, but I have still 0.7.3 code) This is my code, see UPPERCASE comments: // ITEM IS PARENT var item = ...; // This is a bit complicated if this was a folder. Need to // rename it in tree and in cache var fromPath = this.__joinPath(path, fromName); var toPath = this.__joinPath(path, toName); // tree, THIS IS FOLDER ! var renamed = this.__pathToItem(fromPath); if (renamed) { // HERE IS SOMETHING WRONG ? renamed.setLabel(toName); // CAN I USE REMOVE() ? item.remove(renamed); var pos = 1, ch = item.getItems(false, true); while (pos < ch.length && this.__cmp(ch[pos].getLabel(), renamed.getLabel()) < 0) pos++; // THIS WILL ADD IT BACK ? item.addAt(renamed, pos - 1); } So the question is simple, is it correct to use add() and remove() methods ? Thank you:) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel