Re: [flexcoders] Problem with List Item Renderer (and states)
Existing item renderers are reused by the framework to increase the performance. Your itemrenderer should rely on the data only, it should not have local state. In your case, you could store the open/close state of your item renderer in the data object. Cheers Ralf On 2/25/07, nwebb [EMAIL PROTECTED] wrote: Hi, I have a custom item renderer with two states (expanded and collapsed) My items are displayed in a List component, and the data is currently coming from an ArrayCollection. You can see the page here (click on Gig Calender): http://www.bathbands.co.uk/test2007/ Here is an example of the problem I'm facing: 1) Click the Read More button of the first item in the List - it will expand. 2) Scroll down and you can see that the third and last item have also expanded. 3) Scroll back up and you will see that the first item is now in the collapsed state again, but other items are now in the expanded state. I'm not sure what's causing the other items to open/close. I guess it has something to do with Flex redrawing stuff as it goes off screen, and would appreciate suggestions on how best to prevent this kind of thing from happening. Cheers, Neil -- Ralf Bokelberg [EMAIL PROTECTED] Flex Flash Consultant based in Cologne/Germany Phone +49 (0) 221 530 15 35
RE: [flexcoders] Problem with List Item Renderer (and states)
In your itemRenderer, you must update a property in the dataProvider item when the user causes the state to change, and in the overrides set data() function, you must read this item property and set the state accordingly. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of nwebb Sent: Sunday, February 25, 2007 8:04 AM To: flexcoders Subject: [flexcoders] Problem with List Item Renderer (and states) Hi, I have a custom item renderer with two states (expanded and collapsed) My items are displayed in a List component, and the data is currently coming from an ArrayCollection. You can see the page here (click on Gig Calender): http://www.bathbands.co.uk/test2007/ http://www.bathbands.co.uk/test2007/ Here is an example of the problem I'm facing: 1) Click the Read More button of the first item in the List - it will expand. 2) Scroll down and you can see that the third and last item have also expanded. 3) Scroll back up and you will see that the first item is now in the collapsed state again, but other items are now in the expanded state. I'm not sure what's causing the other items to open/close. I guess it has something to do with Flex redrawing stuff as it goes off screen, and would appreciate suggestions on how best to prevent this kind of thing from happening. Cheers, Neil