Flex 3 でカスタム列を使用して を表示するアプリケーションを作成しましたdatagrid
。このコードでメソッド loadDetails にアクセスするにはどうすればよいですか?:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
public function loadDetails(id:String) : void { // Some code here
}
]]>
</mx:Script>
<mx:DataGrid dataProvider="{[{id:'123456',name:'',address:''}]}">
<mx:columns>
<mx:DataGridColumn headerText="Serial" dataField="id"/>
<mx:DataGridColumn headerText="Cliente" dataField="name"/>
<mx:DataGridColumn headerText="Dirección" dataField="address"/>
<mx:DataGridColumn width="50" dataField="id" headerText="">
<mx:itemRenderer>
<mx:Component>
<mx:LinkButton label="" toolTip="Details" icon="@Embed('../resources/icons/details.png')" click="loadDetails(data.id);">
</mx:LinkButton>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Application>
このコードを実行しようとすると、Flex がエラーをスローします。loadDetails が定義されていないと言っています。そのエラーはスコープによるものだと思います。しかし、私はそれを解決する方法についてまったく考えていません。