我有一个从DataGrid和从DataGridColumn扩展的CustomDataGridColumn扩展的CustomDataGrid。注入模型后没有设置函数绑定
CustomDataGridColumn具有Function类型的成员变量。
在我看来,我用香菜注入演示模型。
的代码如下:
<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是一个公共函数。
欧芹语境文件在上述文件的父,并声明PM如下:
AssocDocPMFactory是装饰有[出厂]鞋底函数的类。
所以问题是:
当我调试应用程序,并检查DataGrid的columnList,变量modifyLabelField为空。
函数绑定的处理方式与变量不同吗?我正在使用Flex 4.5.1和Parsley 2.4.1
我明白注入可能会在creationComplete被调用后发生,但我认为绑定会照顾到这一点。
我有一种感觉,模型 - PM - 直到很久以后才为null,并且没有触发函数绑定。
我试图使用FastInject,但无济于事。
这是函数指针和Flex绑定的问题吗?
不是你的问题的答案,而是一个观察:你不应该扩展GridColumn,除非你想改变或添加到它的功能。几乎没有任何需要。我最近有一个[类似的讨论](http://stackoverflow.com/questions/10520158/flex-application-is-confused-when-passing-variables-to-custom-component)。 – RIAstar