I have an AdvancedDataGrid (ADG) with a HierarchicalData dataProvider:
<mx:AdvancedDataGrid xmlns:mx="http://www.adobe.com/2006/mxml"
dataProvider="{__model.myHierarchicalData}"
displayItemsExpanded="true" sortExpertMode="true" dropEnabled="true"
sortableColumns="false" draggableColumns="false"
resizableColumns="true" textAlign="left" defaultLeafIcon="{null}"
folderOpenIcon="{null}" folderClosedIcon="{null}"/>
When I initially set the HierarchicalData instance in the Model, it is displayed as expected:
function buildHierarchicalData(parentItems:ArrayCollection):void
{
__model.myHierarchicalData = new HierarchicalData();
__model.myHierarchicalData.source = parentItems;
}
parentItems is a Collection of ParentItem valueObjects:
package
{
[Bindable]
public class ParentItem
{
public var children:ArrayCollection;
public var label:String;
}
}
However, when I move child items from one parent to another (via drag-and-drop), the update is not visible, using this code:
function moveChildren(movedChildren:Array /* of ParentItem */):void
{
parentItem.children = new ArrayCollection(movedChildren);
}
For some reason, however, this DOES work:
function moveChildren(movedChildren:Array /* of ParentItem */):void
{
parentItem.children.source = movedChildren;
}
Why do I have to update the source of the ArrayCollection???