如何反映itemRenderer中list.selectedItem的变化?

时间:2010-10-22 10:06:32

标签: flex flex4

当我改变: list.selectedItem.name ='name2'

然后在我的项目渲染器中

不会触发dataChange事件! 我无法使用name属性更新标签...

任何帮助?

2 个答案:

答案 0 :(得分:2)

只有dataProvider的添加和删除会自动更新 - 对于要自动反映的现有项目的修改,要更新的特定属性应声明为[Bindable]。检查name属性是否可绑定。

public class Item
{
  public var noBinds:String = "initvalue";
  [Bindable]
  public var bindMe:String = "initvalue";

  //a constructor that takes two arguments goes here
}

//dp is the dataProvider of a data grid with two columns:

//this will add new item to the grid
dp.addItem(new Item("blah", "blah1"));

/* update the selected item */

//not bindable
dp.selectedItem.noBinds = "new string; but not shown";

//update the Bindable item
dp.selectedItem.bindMe = "new string; this will be updated";

答案 1 :(得分:0)

制作name属性bindable