我有一个从 DataGrid 扩展的 CustomDataGrid 和一个从 DataGridColumn 扩展的 CustomDataGridColumn。
CustomDataGridColumn 具有函数类型的成员变量。
在我看来,我使用 parsley 注入了一个演示模型。
代码如下:
<fx:Declarations>
<spicefactory:Configure/>
</fx:Declarations>
<fx:Script>
[Inject(id="associatedDocumentsPM")]
[Bindable]
public var model:AssociatedDocumentsPM;
</fx:Script>
<customDataGrid:CustomDataGrid id="AssocDocGrid"
width="100%" height="{(documentDataList.length+2)*20}"
doubleClickEnabled="true" enabled="{modeHandler.appEnable}"
dataP="{documentDataList}"
sortableColumns="false">
<customDataGrid:columnList>
<customDataGrid:CustomDataGridColumn
textAlign="left"
dataFieldIdentifier="documentName"
headerText="Document Type"
modifyLabelField="{model.modifyLabelField}"
dataField="documentName"
isNaNZero="true"
showDataTips="true"
editable="false"/>
...more columns here...
</customDataGrid:columnList>
</customDataGrid:CustomDataGrid>
AssociatedDocumentsPM 定义了函数,这些函数在列中设置。
一个例子是属性modifyLabelField="{model.modifyLabelField}"
CustomDataGridColumn.myLabelField 是函数类型。AssociatedDocumentsPM 中的 myLabelField 是一个公共函数。
Parsley Context 文件位于上述文件的父级中,并声明 PM 如下:
AssocDocPMFactory 是一个具有用 [Factory] 装饰的唯一函数的类。
所以问题如下:
当我调试应用程序并检查 DataGrid 的 columnList 时,变量 modifyLabelField 为空。
函数绑定与变量的处理方式不同吗?我正在使用 Flex 4.5.1 和 Parsley 2.4.1
我知道在调用 creationComplete 之后可能会发生注入,但我认为绑定会解决这个问题。
我有一种感觉,模型 - PM - 直到很久以后才为空,并且没有触发函数绑定。
我也尝试使用 FastInject 但无济于事。
这是函数指针和 Flex 绑定的问题吗?