Hi flexcoders,
 
I've come across a potential bug in an app I'm working on, but perhaps I'm doing something wrong.  I have an array of VOs where each VO has an array of children VOs.  I'm using a nested repeater to represent this structure.  The user can add parents and children - this is when some strange behavior occurs.  Some repeater rows in the nested repeater appear blank.  I tried the whole dummy UI object filler to no avail.  Here's a sample app that illustrates the problem.  Just add a few parents and then add children and you'll see a lot of repeated rows.  Any help would be appreciated:
 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
 xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="absolute"
 width="100%"
 height="100%"
    creationComplete="init()"
 >
 
 <mx:Panel id="main"
  width="100%"
  height="100%"
     title="Testing representing complex structure in nested repeater"
     >
    
     <mx:Repeater id="rpParents"
      dataProvider="{this.dpParent}">
      <mx:HBox width="100%">
       <mx:Text id="txtParentName"
        width="100%"
        paddingLeft="100"
        text="{rpParents.currentItem.name}"
        />
    <mx:Button id="btnAddChild"
     label="Add a child to this parent node"
     click="this.handleAddChildClick(event);"
     />       
      </mx:HBox>
   <mx:Repeater id="rpChildren"
    dataProvider="{ rpParents.currentItem.children}"
    >
       <mx:Text id="txtChildName"
        width="100%"
        paddingLeft="200"
        text="{ rpChildren.currentItem.name}"
        />     
   </mx:Repeater>
     </mx:Repeater>
  
  <mx:ControlBar
   width="100%"
   horizontalAlign="right">
   <mx:Button id="btnClearParents"
       label="Clear all parents"
       click="this.dpParent = new ArrayCollection();"
    />
   <mx:Button id="btnAddParentNode"
       label="Add a new parent node"
       click="handleAddParentClick();"
    />
  </mx:ControlBar>
 </mx:Panel>
 
 
 <mx:Script>
  <![CDATA[
   import mx.collections.ArrayCollection;
   import mx.core.UIComponent;
      
   [Bindable]
   public var dpParent:ArrayCollection;

   public function init() : void
   {
    dpParent = new ArrayCollection();
   }
   
   public function handleAddParentClick():void
   {
    var newParent:Object = new Object();
    newParent.name = "Parent number " + (dpParent.length + 1);
    newParent.children = new ArrayCollection();
    
    this.dpParent.addItem(newParent);
   }
   
   public function handleAddChildClick(event:MouseEvent):void
   {
    var parent:Object = UIComponent(event.currentTarget).getRepeaterItem();
    var newChild:Object = new Object();
    newChild.name = "Child number " + (ArrayCollection(parent.children).length + 1);
    
    ArrayCollection(parent.children).addItem(newChild);    
   }
  ]]>
 </mx:Script>
  
</mx:Application>

 

Thanks,

 

Jaime

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to