hey u can check the solution in my blog http://flexphpworld.wordpress.com/2010/01/28/using-checkbox-as-item-renderer-in-datagrid
On Jan 28, 9:41 pm, Soumya Here <contacttosou...@gmail.com> wrote: > Hi, > > I have a problem while selecting a checkbox in a datagrid.....when I select > the checkbox it shows as selected....but when I deselect it....again it > shows as selected. > I want to track the checkbox selection is checked or not on a particular > data.....please help. > > Code as below, > > <mx:Application > xmlns:mx="http://www.adobe.com/2006/mxml" > xmlns:control="com.portal.control.*" > xmlns:business="com.portal.business.*" > xmlns:view="com.portal.view.*" > layout="absolute"> > > <mx:Script> > <![CDATA[ > import com.portal.vo.LoginVO; > import com.portal.event.CustomTextClick; > import com.portal.model.*; > import mx.collections.ArrayCollection; > import mx.controls.Alert; > [Bindable] > public var modelLocator:ModelLocator = ModelLocator.getInstance(); > > //This is function called when checkbox value changed from selected to > deselected or vice versa > public function valueCheck(event:Event):void > { > > if(dg2.selectedItem) > { > Alert.show("Hi I am selected"); > } > if(!dg2.selectedItem) > { > Alert.show("Hi I am not selected"); > } > > } > > ]]> > </mx:Script> > > <mx:DataGrid id="dg2" dataProvider="{modelLocator.user}" x="548" y="64"> > /////Please assume for testing="{modelLocator.user}" as a ArrayCollection > <mx:columns> > > <mx:DataGridColumn headerText="Password" dataField="userPassword"/> > <mx:DataGridColumn headerText='UserId' dataField="userId"/> > > <mx:DataGridColumn headerText="Please Select"> > <mx:itemRenderer> > <mx:Component> > <mx:VBox> > <mx:CheckBox change="outerDocument.valueCheck(event)"/> > </mx:VBox> > </mx:Component> > </mx:itemRenderer> > </mx:DataGridColumn> > </mx:columns> > </mx:DataGrid> > > </mx:Application> > > Thanks, > Soumya -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.