On another note, you're
correct that flex does add the uids, and my solution was just to get the sample
working so that the poster could see it properly.
For you, and the original poster this is not best
practice, be aware that the actual problem is that the items added to the bottom
list were a reference
to the item in the tree
instead of a copy or new item, so the uid was not reset for the added item, this
caused a double reference. A better solution for the sample would be
changing
this line
listDP.addItem(prodTree.selectedItem);
to this
listDP.addItem(prodTree.selectedItem.copy());
I really did not think
too much about it when I gave a quick solution. For the original poster Hal
is correct in that you don't need to do this unless you need an "exact copy". It
worked because you changed the item being added and flex did in that case change
the uid. You should not add the uid yourself as an attribute unless
you require it elsewhere.
The problem is not
really a bug, the problem was references,
and pointers getting out of wack and flex does not like that :)
Milan if you require a
clearer explanation then feel free to ask. I hope this clears it up a bit better
for you.
As for the sample I
think it should be changed as it obviously can cause confusion for
people.
Sorry for the
confusion.
Jason
Sorry, but this is not true. I've seen this typo immediately, because
withouth this question mark flex builder does not color code. But the problem
I described remain. If Flex should generate UIDs, please take a look at
example and find out what is wrong with it. I don't have enought insight and
experience to find a problem, but I can say that jasons code works fine.
Thanks.
Best regards, Milan
On 7/7/06, hal_lichtin <[EMAIL PROTECTED]> wrote:
There is a bug in the example, but it is a one-character typo and
does not require you to modify the doTreeSelect() method. Simply add
a question mark as the next to the last character of the first line
of the code, so it reads as follows:
<?xml
version="1.0"?>
You should not have problems compiling or running
the application then.
Flex automatically generates UIDs for
XMLListCollection objects and you should not need do this
yourself.
Hal Lichtin Senior Technical Writer Adobe
Systems [EMAIL PROTECTED]
--- In [email protected], "milan kosir"
<[EMAIL PROTECTED]> wrote: > > Yes, it works fine.
Thanks! > Milan >
> On 6/30/06, milan kosir <[EMAIL PROTECTED]>
wrote: > > > > Thank you very much, Jason, > > I
can't test it before tomorow, but I'm already happy :) > > >
> > > Milan > >
> > On 6/30/06, Jason
Hawryluk < [EMAIL PROTECTED]> wrote: > > > > > > That
sample is buggy > > > > > > > > >
replace the below code > > > > > > private function
doTreeSelect():void > > > { > > > if
(prodTree.selectedItem) > > >
listDP.addItem(prodTree.selectedItem); > > > } > >
> > > > with the below > > > > > >
import mx.utils.UIDUtil; > > > private function
doTreeSelect():void > > > { > > > if
(prodTree.selectedItem) > > > var newnode:Object =
prodTree.selectedItem.copy(); > > > > > >
[EMAIL PROTECTED] = mx.utils.UIDUtil.createUID().toString(); > >
> > > > > > > listDP.addItem(newnode); >
> > } > > > > > > and it works as it
should > > > > > > Jason > > > >
> > > > > > > > -----Message
d'origine----- > > > *De :* [email protected] [mailto: [email protected]]*De > > > la part
de* milan kosir > > > *Envoyé :* vendredi 30 juin 2006
15:26 > > > *À :* [email protected] > > > *Objet :* Re:
[flexcoders] Using the XMLListCollection class bug > > > >
> > Thank you, Jason, > > > this is a great news! >
> > > > > As I said, maybe it is a bad example, or maybe I
just don't know how to > > > use it? > > >
Because when I add some "bananas" to the list, first they are not >
> > selectable except the last one, > > > then when they
are removed, they are not properly removed from the tree, > >
> and on the end the tree can't render anymore. > > > I'm
interesting in this because I'd like to write a "lazy tree", to
get > > > child items from database when they are needed (when
the node is opened). > > > If anybody has done this and could
give me a hint, I'd be gratefull. > > > > > >
Thanks, Milan > > >
> > > On 6/30/06, Jason
Hawryluk < [EMAIL PROTECTED]> wrote: > > > > > > >
> I'm very happy to report that the tree component is
working very > > > > well. All the outstanding bugs I've
checked have been corrected (i have a > > > > few left to
look into). The binding is working. > > > > > > >
> jason > > > > > > > > > > >
> -----Message d'origine----- > > > > *De :* [email protected] [mailto: [email protected]] > > > > *De la
part de* kosir.milan > > > > *Envoyé :* vendredi 30 juin 2006
12:03 > > > > *À :* [email protected] > > > > *Objet
:* [flexcoders] Using the XMLListCollection class bug > > >
> > > > > Hi, > > > > I'd like to report
that example in chapter "Using the > > > > XMLListCollection
class" > > > > (http://livedocs.macromedia.com/flex/2/docs/00000513.html#406668
) > > > > which can be found under (Flex 2 Developer's
Guide > Building User > > > > Interfaces for Flex
Applications > Using Data Providers and > > > >
Collections > Using hierarchical data providers) does not work as >
> > > expected and produces very strange results. > > >
> Could somebody confirm that f2b3 bug in tree dataproviders
is removed > > > > or not? Maybe there is problem only
with example. > > > > I'd really like to know if Flex 2 allow
to make dynamic databinding > > > > for Tree component.
Any hint or working example would be highly > > > >
appreciated. > > > > Milan > > > > >
> > > > > > > > > > > >
> >
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
__,_._,___
|