getItemIndex is looking for exact match, as in it passes a == b.  since you have two different object instances (in memory) regardless of the mx_internal_uid property they will not match.  ArrayCollection is not set up to support something like the Java .equals method, so if you want to change the behavior you’ll need to subclass and adjust yourself.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Wayne McFetridge
Sent: Thursday, July 27, 2006 8:36 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] getItemIndex(someObj) -- mx_internal_uid

 

I'm looking at doing this to prevent drag from datagrid into a"
favourites" panel if the user already has that item in favs.

Drag from data gird, the panel that may receive the drop does a check of
the "favourites" arraycollection via

"*model.favourites,getItemIndex(theItemImDragging)*"

and if returns *-1* accepts the drop otherwise no go.

The arraycollection of favourites and the arraycollection in the grid's
dataProvider are both just arraycollections of my own WineVO.

Docs say that getItemAt returns -1 if the obj is not in the
ArrayCollection and mentions an "exact match".

My question is "does this exact match take into account the
"mx_internal_uid" that flex carries around in each item in an
arraycollection?
I'm guessing it does because when I drag a "new" item into my panel I
accept the drop and then if i try to repeat I get no drop, as I want.

If however I do another search, returning the same finds but now in a
re - sourced arraycollection with diff internal_uid's and try to drop
them it allows the drop to happen and I get duplicates in my favourites.

I'm seeing that the only difference is the "mx_internal_uid" is
obviously different in the datagrids arraycollection dataprovider.

Any way of handling this, or doing it differently

wayne mcfetridge
--

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to