1
我使用下面的代碼選擇/取消選擇在數據網格
柔性選擇/取消選擇在數據網格的所有複選框
<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>
我想unselct checkAll複選框,當我取消選擇所有複選框行復選框, 我正在嘗試訪問值checkAll到check_clickHandler(),但我沒有得到它的價值。
我該怎麼做?