2

当 DataProvider 的长度发生变化时,如何设置要调用的函数?

4

3 回答 3

1

这是使用事件 "CollectionEvent.COLLECTION_CHANGE" 的一个很好的解决方案:

http://blog.flexexamples.com/2008/12/16/detecting-when-the-data-provider-of-a-datagrid-control-changes-in-flex/

于 2011-02-06T14:45:17.740 回答
0

如果您正在使用 ICollectionView(又名 ArrayCollection),则可以为“collectionChange”事件添加事件侦听器。

文档:http ://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/collections/ListCollectionView.html#event:collectionChange

如果您在 MXML 文档中,则 UI 组件的 dataProvider 属性应该是数据绑定的来源。因此,如果这是用例,您可以只 {myComponent.dataProvider.length} 将值绑定到其他东西。

于 2011-02-06T14:47:03.157 回答
0

我可以通过它的唯一方法是在动作脚本代码中进行绑定。像这样的东西:

protected function creationCompleteHandler(event:FlexEvent):void {
    BindingUtils.bindSetter(myHandleFunction, myList, "dataProvider");
}

myHandleFunction 通过参数接收具有绑定属性类型的对象。

于 2013-05-14T13:04:24.490 回答