flex 4.6 datagrid列插入来自另一列的数据


flex 4.6 datagrid column insert datas from another

起初,我很乐意忽略我的语言技能。我正在用sdk 4.6.0(flex+php)在flex中创建一个在线应用程序

我想做的是从另一个数据网格列数据中更改一个数据栅格列数据(如果更简单的话,也可以相同)。

我的数据网格看起来像:

id | name | type | type1 | type2 | type3 | ... | type52

此网格中的数据提供程序是一个数据库表,结果将作为新的arrayCollection。我想在type column中创建这个新的arrayCollection,其中包含所需的typeX列数据。每种类型都有相同数量的行。类型X的选择是通过按下不在数据网格中的按钮进行的。列可见功能不是解决方案,因为在应用程序的其他部分,我使用的是dataFiled="type" as text{function}

请告诉我是否需要一些额外的信息。

您可以使用ObjectProxy类。例如:

package {
import flash.utils.flash_proxy;
import mx.utils.ObjectProxy;
public class Wrapper extends ObjectProxy {
    public function Wrapper(item:Object = null) {
        super(item);
    }
    override flash_proxy function getProperty(name:*):* {
        if (name == "type1")
            return "someValue";
        if (name == "type2")
            return "otherValue";
        return super.flash_proxy::getProperty(name);
    }
}
}

当您创建ArrayCollection时,请使用以下函数:

public function wrapCollection(arrayCollection:IList):IList {
    var list:Array = [];
    for each (var item:Object in arrayCollection) {
        list.push(new Wrapper(item));
    }
    return new ArrayCollection(list);
}

现在您可以使用dataFields type1type2