Adding or removing from a sorted or filtered view is problematic whether
you use IList or IViewCursor.

 

Let's say I have numbers:  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

I filter for only multiples of 3:  3, 6, 9, 12

 

If I then call addItemAt(99, 1), where should it go?  Somewhere between
3 and 6, but where? Before 4? 5? 6?

 

Depending on your scenario, you may want to manipulate an unfiltered,
unsorted list that shares the same source as the sorted/filtered
collection.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Anita Karst
Sent: Thursday, December 13, 2007 3:12 PM
To: [email protected]
Subject: [flexcoders] Flex newbie has ICollectionView confusion...

 

Hello Flexcoders,

 

I apologize if this is a question that has already been beat to death -
but I can't seem to find anything explicit about this... 

 

In the Flex documentation under the topic "Using IList interface methods
and properties", there is a clearly marked note that says...

 

"If you use the ICollectionView interface to sort or filter a
collection, do not use the IList interface to manipulate the data, as
the results are indeterminate."

 

So, to make sure I understand, if you have an array collection that has
been sorted and/or filtered, you can not then subsequently use the easy
IListlist methods (i.e. addItemAt, getItemAt, setItemAt, etc.)
successfully against this collection.  As I understand, to alter an item
in this collection, you need to use the less-obvious IViewCursor methods
of remove-coupled-with-insert to alter an item in the collection.  Am I
on the right track here?  Or, is there some other best-practice?

 

Thanks for your time,

 

Anita

 

 

Reply via email to