起初我会因为忽视我的语言技能而感到高兴。 我正在使用sdk 4.6.0(flex + php)
在flex中创建一个在线应用程序我要做的是将1个datagrid列数据从另一个更改(或者如果它更简单则更改)。
我的数据网格如下:
id | name | type | type1 | type2 | type3 | ... | type52
此网格中的数据提供程序是一个db表,而不是结果作为新的arrayCollection。
我想在类型列中创建所需的typeX列数据的新arrayCollection。每种类型都有相同的行数。
选择typeX是按下按钮,而不是位于数据网格中。
列可见函数不是解决方案,因为在应用程序的其他部分我正在使用dataFiled="type" as text{function}
等。
如果需要其他一些信息,请与我们联系。
答案 0 :(得分:0)
您可以使用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 type1
和type2