2 Replies Latest reply on Apr 12, 2011 9:25 AM by paatfv10

    Items in ItemRenderer for DataGroup are being superimposed.

    paatfv10

      Hi,

      I'm trying to learn about itemRenderers in flex, but they don't seem to be working correctly for me.

       

      Here snippets of my code:

       

      <s:BorderContainer includeIn="normal" x="10" y="212" width="470" height="165">
                  <s:Scroller height="100%" width="100%">
                      <s:DataGroup itemRenderer="itemRender"
                                   width="470%" height="165" clipAndEnableScrolling="true">
                          <mx:ArrayList>
                              <fx:String>Dave Jones</fx:String>
                              <fx:String>Mary Davis</fx:String>
                              <fx:String>Debbie Cooper</fx:String>
                          </mx:ArrayList> 
                      </s:DataGroup>
                  </s:Scroller>
              </s:BorderContainer>

       

      here is my itemRenderer:

       

      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      autoDrawBackground="true"
                      width="100%">
          <s:Group width="100%">       
              <s:layout>
                  <s:HorizontalLayout verticalAlign="top"/>
              </s:layout>
              <s:Label text="msg"/> <!-- this is just to show that the item is being rendered correctly -->
          </s:Group>
      </s:ItemRenderer>

       

      This is just a POC test. Eventually, my dataprovider will be stored in actionscript code inline and new instances will be added to it using + and - buttons. I noticed that the items rendered were being superimposed when i first implemented my dynamic itemRenderer and every time I'd add a new item the 'msg' label would get bolder and bolder, suggesting that they are simply getting superimposed.

       

      So i then tried the above test, simple i thought that maybe modifying the dataProvider would screw up the item rendering somehow, but what with three strings in my dataProvider, i'd expect to see three rows with 'msg' written, but I only see one.

       

      I might have missed a setting somewhere in my tags, hopefully it's as simple as that. Any ideas as to why this is happening?