Hi,
I'm trying to create a nested list in Flex which will dynamically resize to display all children when the data provider changes.
Here's a simplified example which illustrates the problem:
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var outer:ArrayCollection = new ArrayCollection(["one", "two", "three"]);
[Bindable]
public var inner:ArrayCollection = new ArrayCollection([]);
public function addInnerListItems () : void {
inner.addItem("fish");
inner.addItem("mice");
inner.addItem("cats");
inner.addItem("bats");
}
]]>
</mx:Script>
<mx:Button label="Add inner list items" click="addInnerListItems()" />
<mx:List dataProvider="{outer}" rowCount="{outer.length}">
<mx:itemRenderer>
<mx:Component>
<mx:VBox>
<mx:Label text="{this.data}" />
<mx:List dataProvider="{outerDocument.inner}" rowCount="{outerDocument.inner.length}">
<mx:itemRenderer>
<mx:Component>
<mx:Label text="{this.data}" />
</mx:Component>
</mx:itemRenderer>
</mx:List>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:List>
The list sizes remain static when items are added.
If I add variableRowHeight="true"
to the outer list then the inner lists will correctly resize. But the outer list itself remains at a fixed size.
How can I have both lists resize automatically to display all children?
Thanks! Stu