Flex 属性 绑定到数据网格 dataProvider 数组
Flex property binded to datagrid dataProivder array
我的应用程序 mxml 中有以下数据网格:
<event:SelectRowDataGrid id="resultDG"
dataProvider="{model.EventDTOs}"
...
<event:columns>
...
SelectRowDataGrid 是我对 Flex DataGrid 的扩展:
package xx.xx.xx.xx.event
{
import mx.controls.DataGrid;
public class SelectRowDataGrid extends DataGrid
{
private var _checkedItems:Array;
public function SelectRowDataGrid() {
super();
_checkedItems = new Array();
}
public function get checkedItems():Array
{
for each (var event:EventDTO in dataProvider) {
if(event.checked)
_checkedItems.push(event);
}
return _checkedItems;
}
}
}
我正在尝试设置启用的按钮 属性,如下所示:
<controls:PrintButton enabled="{resultDG.checkedItems.length>0}"
但是我在构建时遇到以下错误:
Multiple markers at this line:
-Data binding will not be able to detect assignments to "length".
-checkedItems
我错过了什么?
正如 Timofei Davydik 所暗示的那样
向 class 添加 [Bindable] 注释使其成为现实:
[Bindable]
public class SelectRowDataGrid extends DataGrid
{
...
我的应用程序 mxml 中有以下数据网格:
<event:SelectRowDataGrid id="resultDG"
dataProvider="{model.EventDTOs}"
...
<event:columns>
...
SelectRowDataGrid 是我对 Flex DataGrid 的扩展:
package xx.xx.xx.xx.event
{
import mx.controls.DataGrid;
public class SelectRowDataGrid extends DataGrid
{
private var _checkedItems:Array;
public function SelectRowDataGrid() {
super();
_checkedItems = new Array();
}
public function get checkedItems():Array
{
for each (var event:EventDTO in dataProvider) {
if(event.checked)
_checkedItems.push(event);
}
return _checkedItems;
}
}
}
我正在尝试设置启用的按钮 属性,如下所示:
<controls:PrintButton enabled="{resultDG.checkedItems.length>0}"
但是我在构建时遇到以下错误:
Multiple markers at this line:
-Data binding will not be able to detect assignments to "length".
-checkedItems
我错过了什么?
正如 Timofei Davydik 所暗示的那样
向 class 添加 [Bindable] 注释使其成为现实:
[Bindable]
public class SelectRowDataGrid extends DataGrid
{
...