flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark goldin <markzolo...@gmail.com>
Subject Problem with checkbox in mx DataGrid
Date Wed, 29 Apr 2015 15:23:30 GMT
Here is my datagrid definition:
<?xml version="1.0" encoding="utf-8"?>
<mx:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"
 xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
override public function set dataProvider(value:Object):void
{
if (value)
{
super.dataProvider = value;
}
}
public function applyToAllPoints_changeHandler(event:Event):void
{
selectedItem.Selected = event.target.selected;
}
]]>
</fx:Script>
<mx:columns>
<mx:DataGridColumn dataField="Name" headerText="Point" width="260">
<mx:itemRenderer>
<fx:Component>
<mx:HBox width="100%" verticalAlign="middle" backgroundAlpha="0"
paddingLeft="5">
<mx:CheckBox selected="{data.Selected}"
click="outerDocument.applyToAllPoints_changeHandler(event)"/>
<mx:Label
text="{data.Name}"
paddingTop="0"
paddingBottom="0"
/>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>

I am using applyToAllPoints_changeHandler function to update dataProvider
with checkbox selection. This has no problem, but selectedItem.Selected is
null because clicking on a checkbox does not select a row?
I also tried <mx:CheckBox selected="{data.Selected}"
click="data.Selected=selected"/>
but it says "Access of undefined property selected".

How do I update underlying data selecting a checkbox in the grid?

Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message