Flex 4 Datagrid itemrender
I'm using s:MXDataGridItemRenderer
for my Datagrid. The click event for an image inside the ItemRenderer is not getting dispatched.I have pasted my code below.
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"
itemRende开发者_StackOverflow社区rer="DecisionColumnItemRenderer"
editable="false"/>
</mx:columns>
</mx:DataGrid>
精彩评论