apache-flex - 弹性 : Filter HierarchicalData child rows

标签 apache-flex filter flex4 flex3 hierarchical-data

我有一个 ArrayCollection 对象,用作 HierarchicalData 对象的源。我的对象大致如下所示:

ObjectName (String)
SubCollection (ArrayCollection)

我正在 AdvancedDataGrid 中使用 HierarchicalData 以分组格式显示数据。

我可以使用 filterFunction 过滤 ArrayCollection 中的数据。我现在想做的是过滤 SubCollection 中的记录,以便只有与过滤器匹配的项目才会显示在 AdvancedDataGrid 中。

谁能告诉我如何过滤 HierarchicalData 中的子行?

最佳答案

This answer不是对你的问题的直接答案,但它应该有助于了解一些背景知识。本质上,我的处境与您相同,我需要根据我拥有的父节点类型来显示特定的数据集。

在这种情况下,从覆盖 HierarchicalData.getChildren(node:Object):Object 开始,这将使您能够过滤第一级子级,并且还使您能够调用针对任何第 n 级子级的过滤方法。

然后,您可以使用扩展类作为 ADG 的源。

伪代码示例:

Class MyCollection extends HierarchicalData

override public function getChildren(node:Object):Object 
{
    if (node is a TopLevelObject)
        (node.children as ArrayCollection).filterFunction = filterSub;
        node.children.refresh();
    else if (node is a SubCollectionObject)
        (node.children as ArrayCollection).filterFunction = filterGrandChildren;
        node.children.refresh();

    // - OR -
        //a more complex process of allowing the sub-node to determine it's filter
        return node.filterSubCollectionGrandChildren();


    return node;
}

关于apache-flex - 弹性 : Filter HierarchicalData child rows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12825752/

相关文章:

java - 按一天中的时间过滤日期(初学者)

apache-flex - flex 4.5 简单的 Spark 按钮蒙皮

java - maven项目可以有多个父项吗?

apache-flex - Flex 中的 JSON。 "Access of undefined property JSON"

javascript - 我如何在 Javascript 和 Flex 之间进行通信?

Matlab - 通过具有特定值来过滤矩阵

css - 如何使用 CSS 设置 Flex Spark 按钮的边框颜色

C - 无法设置 pcap 过滤器。功能无法正常工作

apache-flex - 绑定(bind)存在 ActionScript 中的属性

ios - Flex Mobile 4.6 应用程序不会在 IOS 上创建数据库?