获取 AdvancedDataGrid 中扩展节点下的项目

发布于 2024-12-28 13:51:07 字数 870 浏览 1 评论 0原文

有没有办法获取扩展 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.
    }

Is there a way to get the items which are under an expanded ADG tree node?

Given the sample tree node:

- Atlantic
    Celtics
    Nets
    Knicks
    Sixers
    Raptors
+ Central
+ SouthEast
+ SouthWest
+ NorthWest
+ Pacific

I am planning to capture the data in the ADG's itemOpen event.

private function myADG_ItemOpen(event:AdvancedDataGridEvent) :void
{
  // What codes do I put here to get the following teams:
  // Celtics, Nets, Knicks, Sixers, Raptors
}

Update:
I managed to pull off some codes that somehow provides me an object containing the teams:

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.
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云之铃。 2025-01-04 13:51:07

您可以从 AdvancedDataGridEvent 获取 ADG,然后尝试将其 dataProvider 转换为 IHierarchicalCollectionView。如果有效,您可以使用它来获取打开的节点的子节点。

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
        }
    }
}

You can get the ADG from the AdvancedDataGridEvent and then you can try to cast its dataProvider to an IHierarchicalCollectionView. If that worked you can use it to get the children of the opend node.

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
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文