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
Copy link to clipboard
Copied
try, validateNow() and invalidatePorperties() on your list
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
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.
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.
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
Copy link to clipboard
Copied
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.