Matt Maher escreveu:
> Setup:
> I have a tilelist with a customer item renderer and an array
> collection dataprovider. The array collection has 100 items. The list
> can show 10 renerers on the screen.
>
> Problem:
> When I change (filter) the underlying array collection to 5 items the
> list redraws correctly in that there are only 5 items in it, but it's
> just the 1st 5 which were on the list before the filter.
>
> Basically, the array is changing, the list is changing, but the 1st 5
> itemRenderers are not redrawing. Looking at the underlying array the
> 5 elements are, in fact, different than what is being drawn on the
> screen. It's as if they just are not being re-bound.
>
> Anonther example:
> Since only 10 can show in the list, when I filter the collection to
> 50 the scroll bar changes size (showing me that the list has changed)
> but the 10 items showing are the same as they were before the filter.
>
> HOWEVER!
>
> If I scroll down, then back up (thus taking those 10 off the screen
> and then bringing them back on) they are rendered correctly. In other
> words, it is just that the items which were already drawn on the
> screen are not being refreshed.
>
>
> I have tried list.executeBindings();
> list.invalidateDisplayList();
> list.invalidateList();
> list.invalidateProperties();
>
> I have tried making a new array collection and changing the data
> provider of the list, but nothing works.
>
>
>
> Is there a way to go into the items of the list and "refresh" or "re-
> render" them? And what am I doing wrong to make this necesarry??
>
> Please help
>
>
>
> --
> 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
>
>
>
>
> __________ NOD32 2747 (20071225) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>
I've run into many problems concerning lists and datagrids not updating
when the datasource changes. To prevent this kind of problems I usually
use 2 ArrayCollections (arrays do not fir onUpdate events). One contains
the data and the other the filtered data (and is the dataProvider). When
I want to change the values in the list I do something like
[Bindable] private var dataProvider:ArrayCollection = new ArrayCollection();
private var _data:ArrayCollection = new ArrayCollection();
private function set data(value:ArrayCollection):void {
_data = new ArrayCollection();
_data = value;
dataProvider = new ArrayCollection();
dataProvider = applyFilter(value);
}
private function applyFilter(value:ArrayCollection):ArrayCollection{
// (...) apply some filter to value
return value;
}