0 Replies Latest reply on Apr 8, 2012 9:33 AM by AlastairJMoore

    itemRendererFunction not always called


      Hi all,


      I appear to be having a problem with the itemRendererFunction not being called. I've declared a DataGroup as follows:


        <s:Scroller id="actionsScroller" touchDelay="0" height="176" width="1024" scrollSnappingMode="leadingEdge" pageScrollingEnabled="true">

        <s:DataGroup id="actionsData" dataProvider="{actions}" itemRendererFunction="{selectRenderer}" maxWidth="{actionsScroller.width}" height="200">


        <s:HorizontalLayout />





      and the itemRendererFunction as follows:


                                    private function selectRenderer(item:Object):ClassFactory


                                              var cla:Class = DefaultItemRenderer;


                                              if (item.category == 'SYSTEM')



                                                        cla = ActionRenderer;




        trace('Everything else');

                                                        cla = ActionCustomRenderer;



                                              return new ClassFactory(cla);



      I'm updating my datagroup with a function which looks like:


                                    private function categoryClicked(e:ActionButtonEvent):void


                                              _selectedCategory = e.aid;

                                              actions = _db.actionDAO.list(_selectedCategory);



      This is called by an eventlistener I've added to another datalist. Now this is mostly working correctly as the data is being updated in the datagrid with the new data. However, there are a few issues I'm having. Firstly, the itemRendererFunction isn't always being called.


      Secondly the dataprovider appears to be holding data somehow as there is an addition item of data appearing in the datagroup despite it not actually showing up in the array I'm populating it with!


      Is there any reason this might be occurring? If I can provide some additional code for someone to help me debug this issue, then I'd be more than happy to do so but at the moment I'm banging my head against the wall as there is no logical explanation to me why itemRendererFunction isn't being called every single time.