DataGridから拡張するCustomDataGridとDataGridColumnから拡張するCustomDataGridColumnがあります。
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のタイプはFunctionです。AssociatedDocumentsPM内のmyLabelFieldはパブリック関数です。
Parsley Contextファイルは上記のファイルの親にあり、PMを次のように宣言します。
AssocDocPMFactoryは、[Factory]で装飾された唯一の関数を持つクラスです。
したがって、問題は次のとおりです。
アプリケーションをデバッグしてDataGridのcolumnListを確認すると、変数modifyLabelFieldがnullになります。
関数バインディングは変数とは異なる方法で処理されますか?Flex4.5.1をParsley2.4.1と一緒に使用しています
CreationCompleteが呼び出された後にインジェクションが発生する可能性があることは理解していますが、バインディングがそれを処理すると思いました。
モデル(PM)はずっと後になるまでヌルであり、関数のバインドはトリガーされないように感じます。
FastInjectも使用しようとしましたが、役に立ちませんでした。
これは関数ポインタとFlexバインディングの問題ですか?