• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Best practice for updating a list that is data bound

New Here ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

Hi All,

I have a List component and the data is coming in from a bindable ArrayCollection. When I make changes to the data in the bindable ArrayCollection, the change is not being reflected in the list. I notice that if I resize the browser the component redraws I suppose and then the list updates. But how can I show the update when I change the data in the bindable ArrayCollection instantly?

Thanks,

Ryan

Views

539

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

try, validateNow() and invalidatePorperties() on your list

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2010 Jun 07, 2010

Copy link to clipboard

Copied

Hello, thanks! I've tried that. Even tried both of them together and unfortunately it didnt solve my problem. I'm tempted to try accessing the dataProvider for my list directly and trying to add it in that way but then that doesnt make sense because the data should be coming from my ArrayCollection.. still, when I resize the component it'll refresh and then I see the change.

Is this a common problem?

Ryan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 07, 2010 Jun 07, 2010

Copy link to clipboard

Copied

whycantijuzusemyname wrote:

Is this a common problem?

Ryan

No.  If the ArrayCollection is truly [Bindable] then any changes to it should instantly trigger an update in the List component.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2010 Jun 08, 2010

Copy link to clipboard

Copied

ok thanks for that, I have it sorted out now and found out where the problem was. I got a hint from your statement: "truly [Bindable]"..

Yes, the List is using a bindable ArrayCollection but I'm also using a custom item renderer and this item renderer takes the data and sets the label fields which are not binded. I didnt know that I had to carry the "binding" all the way through. I'm overriding the "set data" function and setting the label fields similar to: myLabel.text = _data.nameHere inside that function. That's where the problem was.

It works great now that I bind the data directly to the Label fields in my custom item renderer. I'm also using functions to parse certain pieces of data too. Is this taxing on the application? I notice that the List updates everytime I scroll, and resetting / calling all the functions in my Labels in the custom itemrender (for example: myDate.text = "{parseDate(_data.date)}")
Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 08, 2010 Jun 08, 2010

Copy link to clipboard

Copied

If the ArrayCollection instance doesn't change, you don't even need to make it bindable.

Adding and removing items from the AC fires CollectionEvents on that AC instance, which makes the List update itself.

Are you using addItem() to modify the AC?

PS Wrong Forum for your type of question -- please post in "Flex" next time

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2010 Jun 08, 2010

Copy link to clipboard

Copied

LATEST

Yes the ArrayCollection instance is changing, and I'm using addItem to add items. I'm also editing the existing elements in the ArrayCollection. Now that I'm binding the data all the way to the actual component (for example, the Label components in my custom item renderer) it works great.

Next time I'll post questions like these in the Flex forum. I find these categories a bit confusing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines