You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by "pkumar.flex" <pr...@gmail.com> on 2015/04/29 17:15:00 UTC

Re: Problem with checkbox in mx DataGrid

Make your value object class as bindable.
On Apr 29, 2015 8:54 PM, "mark goldin [via Apache Flex Users]" <
ml-node+s2333346n10220h5@n4.nabble.com> 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
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-flex-users.2333346.n4.nabble.com/Problem-with-checkbox-in-mx-DataGrid-tp10220.html
>  To unsubscribe from Apache Flex Users, click here
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=cHJhc2hha3VtYXJAZ21haWwuY29tfDF8LTU0MTcyMzE2NA==>
> .
> NAML
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Problem-with-checkbox-in-mx-DataGrid-tp10220p10221.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.