Flex Help: Repeaters not repeating in an Accordian control

I am having a issue with databinding child repeaters inside an accordion control, hopefully you can help...

I have an accordion in a ViewStack (of which,that ViewStack is also in another top-level ViewStack). I have a repeater in each child of the accordion control. The component looks like such:

<mx:Accordion creationComplete="accordianInit()">
    <mx:Box label="Groups" width="100%">
        <mx:Repeater id="rpGroups" width="100%">
            <mx:CheckBox id="chkGroups" 
                label="{rpGroups.currentItem.name}" />
    <mx:Box label="Contacts">
        <mx:Repeater id="rpContacts">
            <mx:CheckBox id="chkContacts" 
                label=quot;{rpContacts.currentItem.full_name}" />


The problem is that if I bind the 2 repeaters in the init function, then both repeaters don't show any data. If I bind the repeaters in the accordianInit function, then only the first repeater (rpGroups) gets databound...

Where should I be data binding the repeaters so that both repeaters repeat properly?

Hopefully this makes sense, if not I can elaborate more, any help is appreciated.


Bind the dataProvider of the repeater to the source in MXML itself:

<mx:Repeater dataProvider="{the_data}" ... />

The reason you're seeing the behavior you are is because the Accordion (and ViewStack) does not create all of it's children right away. It only creates the child that is visible (so, the first Box, and the first ViewStack child initially).

Because of this behavior, when you try to assign data to the repeaters in the first init() event handler the repeaters have no instantiated container to repeat children into. When you assign data to the repeaters in accordionInit() then only the first Box has been created, which is why only the first repeater works.

If you don't want to bind to the data via the dataProvider attribute of the Repeater tag (as I've shown above), then you can use a change handler on the Accordion to set the repeater data as the user changes panes (because as the user clicks into the panes, they get created by the Flex framework).

All of this comes about from the creationPolicy property: http://livedocs.adobe.com/flex/3/html/layoutperformance_05.html

Need Your Help

Sending Paste message to Microsoft programs not working

pinvoke paste sendmessage

I'm trying to send a "paste" Windows Message to the foreground window using the SendMessage method. It works great for most programs, but anything that comes from Microsoft ignores it (tried MSSQL ...