替代数据绑定

时间:2010-10-13 18:12:44

标签: flex actionscript-3

作为将数组集合绑定到数据网格的数据提供程序的替代方法,我可以将数组集合作为数据提供程序分配给数据网格,并且每次更新数组集合时都执行invalidateProperties(); invalidateList(); - 渲染数据网格?

我描述的方法是否有意义?

1 个答案:

答案 0 :(得分:0)

  

我描述的方法是否有意义?

排序。如果使用get / set方法定义了arrayCollection(ac),则无论何时更改数据,都无法在set方法中设置DataGrid上的dataPRovider。

如果你这样做,那么你很可能不必更新DatGrid的属性或displayList,因为替换dataProvider这一事实只会为你做。

这样的事情:

private var _ac : ArrayCollection;
public function get ac():ArrayCollection){
 return this._ac;
}

public function set ac(value:ArrayCollection){
 this._ac = value;
 this.dataGrid.dataProvider = this.ac;
}

Bingo,每次更新ac值时,DataGrid上的dataProvider都会更新。