我正在使用s:MXDataGridItemRenderer
作为我的Datagrid。 ItemRenderer中的图像的click事件没有被调度。我在下面粘贴了我的代码。
ItemRenderer:
<s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true">
<fx:Script>
<![CDATA[
private function acceptBtn_clickHandler(event:MouseEvent):void
{
updateData(false, "Accepted", 1);
}
private function updateData(approved:Boolean, buttonName:String, score:int):void
{
data.approved=approved;
data.score=score;
data.decisionText=buttonName;
}
private function rejectBtn_clickHandler(event:MouseEvent):void
{
updateData(false, "Rejected", 1);
}
]]>
</fx:Script>
<mx:HBox id="imageBox"
horizontalAlign="center"
verticalAlign="middle"
width="100%"
height="100%"
enabled="true"
>
<mx:Image id="acceptBtn"
source="@Embed(source='../../../assets/icons/button-accept.png')"
click="acceptBtn_clickHandler(event)"
buttonMode="true"
toolTip="Accept"/>
<mx:Image id="rejectBtn"
source="@Embed(source='../../../assets/icons/button-reject.png')"
click="rejectBtn_clickHandler(event)"
buttonMode="true"
toolTip="Reject"/>
</mx:HBox>
的Datagrid:
<mx:DataGrid id="testList"
dataProvider="{testListDP}"
width="100%"
height="100%"
editable="true">
<mx:columns>
<mx:DataGridColumn dataField="score"
headerText="Score"
editable="false"/>
<mx:DataGridColumn headerText="Decision"
itemRenderer="DecisionColumnItemRenderer"
editable="false"/>
</mx:columns>
</mx:DataGrid>