0 Replies Latest reply on Feb 13, 2015 12:35 AM by NilsTT

    Clear ItemRenderers

    NilsTT Level 1

      Hello, before you go 'you should not clear item renderers, you should reuse them' hear my out:


      In my application I have a list of items (bound to a data provider), which is relatively small (lets say up to 50 items). But not all items are rendered the same, I use seven types of item renders (that differ in height, in the controls on them, ....). If I use the default value of 'useVirtualLayout' (true) than scrolling this list is almost impossible (even on high end hardware like a Nexus 6). I believe this is because the list can't reuse its itemrenderers properly because of the different layouts. If is set useVirtualLayout to false, loading the list takes a little bit longer, but scrolling is smooth (even on older hardware).

      Now the problem is that below the list there is a 'tabbar' like control with wich the user can filter the different types of items. When the user presses a button on that 'tabbar' the content of the data provider is changed and the list updates accordingly except that the item renderers are reused in the order they where, so I end up with an item of type X rendered as an item of type Y. (the 'GetItemRenderer' function for the list is not called, except if the number of items in the dataproviders is bigger than before)


      So the question is it possible to say to the list that it should clear its ItemRenderers, so that new ItemRenderers will be created?