0 Replies Latest reply on Apr 16, 2008 9:39 AM by Ronnie_Steiner

    using view-states with custom item renderers

    Ronnie_Steiner
      Greetings,

      Can anybody enlighten me, and provide some useful advice with the following issue:

      I am currently developing AIR/Flex3 desktop widget. The widget displays a list of items (custom items – not strings) and performs periodical server polling to refresh the displayed data, using a web service API (every X seconds). Accordingly, I am using a List-derived class with a custom item renderer. This renderer has 4 different view states, and it transitions from one state to another based on user’s activities (as opposed to the timer-based server-polling). So basically imagine a list of items, where one (or more) items is in a different view state then the rest.

      And here’s my problem:

      Each and every time the data updates, it ends invoking the List’s ‘updateDisplayList(…)’. And since Flex makes intelligent re-use of such custom renderers, I have observed the weirdest behaviors and I am really running out of solutions and ideas to try…

      Say there are 3 items in the List’s dataProvider (ArrayCollection). The List automatically instantiates 5 item renderers … 3 of them are used for display at any given moment, 2 extra renderers easing and bettering performance, right? But every scroll operation or data change (again – updateDisplayList) results in these 2 free renderers being brought up for use, and replace the existing renderers (which in turn, toggle off display and become free). One or more of them might already be in a different view state. So the data of those is now viewed in the wrong view state… it is as if the view state traverses down the list from one item to another after each server request, rather than ‘stay in one place’ and keep displaying the item’s data correctly.
      I can’t think of anything I haven’t tried.. So please my fellow Flexers – give me your wit.

      Thanks in advance,
      Ron