There are checkbox in DataGrid examples on my old blog
(blogs.adobe.com/aharui).  You might want to start with one of those.

Looks like you are calling applyToAllPoints_changeHandler before the DG
has a chance to update selectedItem.

-Alex

On 4/29/15, 8:23 AM, "mark goldin" <[email protected]> wrote:

>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

Reply via email to