Reputation: 115
i am using below code to select/deselect all checkbox in datagrid
<mx:DataGridColumn id="testColumn" width="20" sortable="false">
<mx:headerRenderer>
<fx:Component>
<mx:Canvas>
<fx:Script>
<![CDATA[
protected function checkAll_clickHandle(event:MouseEvent):void
{
}
]]>
</fx:Script>
<s:CheckBox id="checkAll" horizontalCenter="0" selected="false" click="checkAll_clickHandler(event)"/>
</mx:Canvas>
</fx:Component>
</mx:headerRenderer>
<mx:itemRenderer>
<fx:Component>
<mx:Canvas width="100%" height="100%">
<fx:Script>
<![CDATA[
protected function check_clickHandler(event:MouseEvent):void
{
data.isSelected = (event.currentTarget as CheckBox).selected;
if(data.isSelected == false)
{
}
}
]]>
</fx:Script>
<s:CheckBox id="check" horizontalCenter="0" selected="{data.isSelected}" click="check_clickHandler(event)">
</s:CheckBox>
</mx:Canvas>
</fx:Component>
</mx:itemRenderer>
i want to unselct checkAll checkbox when i deselect any of row checkbox,
i am trying to access value of checkAll to check_clickHandler(), but i am not getting its value.
how can i do this??
Upvotes: 1
Views: 3593
Reputation: 14221
You can dispatch custom event with bubbling from your item renderer and handle it in your component. Then you can iterate your data provider or use some other algorithm to determine if there are unselected check boxes (data.isSelected
) in data grid.
Upvotes: 1