Internally, we're doing an instance check, not a test of properties to
see if they match.  Unless you've handed the list an array of things
that are the same instances as they are in the dataprovider it won't
match.

 

I can't get to the GIF for some reason.  Are you saying that myAC[0] was
modified so that the sub AC was removed?  I'd go find out what actually
got changed.

 

-Alex

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of qnotemedia
Sent: Wednesday, March 14, 2007 5:55 PM
To: [email protected]
Subject: [flexcoders] Re: Getting "selectedItems" to properly
*select*...

 

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Arrays in Flex and Flash are not watched for changes. After
> you mutate the array you have to set it again.
>
> var tmp:Array = myGrid.selectedItems
> tmp += item;
> myGrid.selectedItems = tmp;

OK - I've retried specificaly what you've shown, and it still doesn't 
work. I assigned a findItems() function to a temporary array, 
arTemp. The function returns an Array of items found. The very next 
line is myGrid.selectedItems = arTemp.

As mentioned in earlier posts, the items in this "found" array have 
precisely matched data to the dataProvider of the grid, and the 
selection still doesn't occur, without any errors either. The *only* 
difference between the two is the "@123456" following the Array 
description in the debugger.

At least I have something that works (three posts back), but now I'm 
running into a similar problem in another area of my app, and I'd 
like to move forward with this thread...

I have another popup with two grids. Grid A has a multi-level 
ArrayCollection. i.e.:
myAC[0].something
myAC[0].somethingElse
myAC[0].anotherAC[0].anotherSomething
myAC[0].anotherAC[1].anotherSomethingElse

myAC[1].something
...etc...

When the user clicks on Grid A (not multi-select), Grid B's 
selectedItems is populated with the second-level AC "anotherAC", like 
this:

gridB.selectedItems = gridA.selectedItem.anotherAC.source

And it works!

BUT!!! When I select another item and come back to the first one, 
the anotherAC level has disappeared without a trace! It disappears 
from all bound ACs.

WTF?! And BTW, I additionally tried the findItems() function as 
mentioned here. The same problem happens in that nothing is selected.

Again, I've put together a gif to express my anxiety:
qnotemedia.com/dissapearing.gif

...this is a before and after shot. On the left is before anything 
has been selected, and on the right, is immediately after a selection 
has occured. On the right side, notice that the 
dgAllRoles.selectedItems is correctly populated, but that both the 
dgSelectedNames dataProvider AND the original AC, selectedDevTeam 
have had thei second tiered item "collectedRoles" completely 
dissapear.

Crossing my fingers that someone can understand this...
- Chris

 

Reply via email to