有没有办法获取扩展的ADG树节点下的项目?
给定样本树节点:
- Atlantic
Celtics
Nets
Knicks
Sixers
Raptors
+ Central
+ SouthEast
+ SouthWest
+ NorthWest
+ Pacific
我打算在ADG的itemOpen事件中捕获数据。
private function myADG_ItemOpen(event:AdvancedDataGridEvent) :void
{
// What codes do I put here to get the following teams:
// Celtics, Nets, Knicks, Sixers, Raptors
}
更新: 我成功地提取了一些代码,这些代码以某种方式为我提供了一个包含团队的对象:
var ihd:IHierarchicalData = IHierarchicalCollectionView(myADG.dataProvider).source;
if(ihd.hasChildren(evt.item))
{
var objGetChildren:Object = ihd.getChildren(evt.item);
var dataString:String = ObjectUtil.toString(objGetChildren);
// From here, I am able to parse the dataString to an array, where I am able to get the team name.
}
答案 0 :(得分:1)
您可以从AdvancedDataGridEvent
获取ADG,然后您可以尝试将其dataProvider
投射到IHierarchicalCollectionView
。如果可行,您可以使用它来获取opend节点的子节点。
private function myADG_ItemOpen(event:AdvancedDataGridEvent):void
{
var grid:AdvancedDataGrid = AdvancedDataGrid(event.currentTarget);
var dataProvider:IHierarchicalCollectionView = grid.dataProvider as IHierarchicalCollectionView;
if (dataProvider && event.item)
{
var children:ICollectionView = dataProvider.getChildren(event.item);
if (children)
{
// do something with the children
}
}
}