After experimenting, I have following error:

The code:
              // tree
              var renamed = this.__pathToItem(path);
              try
              {
                if (renamed)
                {
                  item.remove(renamed);
                  //renamed.destroy();
                  //item.remove(renamed);//.destroy(); //remove(renamed);
                  //item.addAtEnd(renamed);

                  var pos = 1, ch = item.getItems(false, true);
                  while (pos < ch.length &&
this.__cmp(ch[pos].getLabel(), toName) < 0 || ch[pos] === renamed)
                    pos++;
                  //alert("ADDING TO" + (pos-1));
                  item.addAtToFolder(renamed, pos - 1);
                  renamed.setLabel(toName);
                }
              }
              catch (ex)
              {
                alert(ex.toString());
              }

And catched exception is:
Error: Property label of an instance of qx.ui.tree.AbstractTreeElement
is not (yet) ready!

I don't understand it, i'm only removed item and I want to add it on
different place, how I'm doing wrong ?

If I will remove line:
               item.remove(renamed);
I have error Too much recursion.

I checked the demos but I don't know what I'm doing wrong:(

2008/8/14 Petr Kobalíček <[EMAIL PROTECTED]>:
> 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

Reply via email to