> In theory, if you have [Bindable] or [Managed] items in the collection, or
> call itemUpdated appropriately, you do not need to call refresh() again when
> an item's properties change.

I was wondering about the binding of the ArrayCollection itself, not
the elements it contains (which works as expected). I'm wondering if
folks just do what Scott suggested, i.e. add a mx:Binding statement on
the collection and have it call refresh, or is there a different
pattern, something more concise?

For example, if I have a component that needs a filtered view of a
collection, I just pass the collection through a mx:ListCollectionView
first:

<mx:ListCollectionView id="filteredCollection"
source="{myBigCollection}" filterFunction="{myCustomFilterFunc}" />

<mx:List dataProvider="{filteredCollection}" />

The annoyance is that with just that code my filter function never
gets called and my list gets the whole, unfiltered collection. In
other words, refresh() doesn't get called when the source property of
a ListCollectionView changes, just when the *contents* of a
ListCollectionView's source changes.

And that just seems odd to me... and feels like a bad abstraction/API
as it requires me to always wire up some method for calling refresh
when the view's source changes. When would I ever *not* want to
refresh my collection in that scenario? I'd think that specifying a
filter function *implies* you want the view to be filtered, always.

Is Scott's approach the most common idiom for this?

Troy.

Reply via email to