0 Replies Latest reply on Mar 11, 2010 2:48 AM by Giuseppe Muccioli

    Repeater with recycleChildren=true

    Giuseppe Muccioli Level 1

      Hello,

      I've a strange (for me) problem refreshing dataProvider of a Repeater component.

      I'm tying to set an Apple AddressBook's like tool to define in a form the multiplicity of a field, like the phone number.

      This is the pseudo code:

      <mx:Repeater id="rp" dataProvider="{dp}" recycleChildren=true>

           <local:MyFormItem label="{rp.currentItem.label}>

                <mx:TextInput id="ti" text="{rp.currentItem.data}"/>

           </local:MyFormItem>

      </mx:Repeater>

      Where:

      [Bindable] private var dp:ArrayCollection=new ArrayCollection([

                     {label:"Phone", data:"111111111"},

                     {label:"Phone", data:"222222222"},

                     {label:"Phone", data:"333333333"}

                ]);

      This is a snapshot of what appears:

      Screen shot 2010-03-11 at 11.17.30.png

      When I click on the "+" button, what I'm hope to view is a new MyFormItem component as a bottom component, but this is the result:

      Screen shot 2010-03-11 at 11.17.47.png

      The function to add an item is like:

      dp.addItemAt({label:"New", data:""}, dp.length);

       

      Some note:

           - I'm using flash builder 4 beta 2 with SDK 3.5a (but this is the same with 3.4.1);

           - every MyFormItem component is positioned absolutely (the parent is a Canvas with a custom layout procedure);

           - all works well if I set the recycleChildren=false property of the Repeater, but I don't like the successive redraw;

       

      Any suggestion?

      Thanks a lot in advance

      -g