Hi You are right that renderer is being recycled. If you have notice that i am using inline custom item renderer. Secondly, i do hot have property in the dataprovider which is attached to checkbox. So how can i stop itemrenderer to be recycled.
Thanks ilikeflex --- In flexcoders@yahoogroups.com, "turbo_vb" <timh...@...> wrote: > > Your CheckBox itemRenderer is getting recycled after the delete. Use a > custom itemRenderer for the CheckBox. > http://blogs.adobe.com/aharui/item_renderers/ > <http://blogs.adobe.com/aharui/item_renderers/> > -TH > --- In flexcoders@yahoogroups.com, "ilikeflex" <ilikeflex@> wrote: > > > > Hi > > > > I want to remove the row of datagrid. In one of the columns i have > checkbox as item renderer.I select checkbox and i delete the row.But the > challenge, i am facing is that when i remove the row from datagrid, the > next row's checkbox becomes selected which i do not want. How can i > avoid this?? Please see the test case below. > > > > Any pointers are highly appreciated. > > > > Thanks > > ilikeflex > > > > I have a sample test case > > <?xml version="1.0"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> > > <mx:Script> > > <![CDATA[ > > import mx.controls.DataGrid; > > import mx.collections.XMLListCollection; > > > > private var xml:XML=<root> > > <item>string one</item> > > <item>string two</item> > > <item>string three</item> > > <item>string four</item> > > <item>string five</item> > > <item>string six</item> > > </root>; > > > > [Bindable] > > private var xc:XMLListCollection=new XMLListCollection(xml..item); > > > > public function deleteItem(event:MouseEvent):void > > { > > xc.removeItemAt(dg.selectedIndex); > > xc.refresh(); > > } > > ]]> > > </mx:Script> > > <mx:DataGrid id="dg" > > dataProvider="{xc}"> > > <mx:columns> > > <mx:DataGridColumn headerText="String Text" > > dataField="item"> > > <mx:itemRenderer> > > <mx:Component> > > <mx:Text text="{data}"/> > > </mx:Component> > > </mx:itemRenderer> > > </mx:DataGridColumn> > > <mx:DataGridColumn headerText="Delete Item"> > > <mx:itemRenderer> > > <mx:Component> > > <mx:CheckBox label="Delete" > > click="outerDocument.deleteItem(event)"/> > > </mx:Component> > > </mx:itemRenderer> > > </mx:DataGridColumn> > > </mx:columns> > > </mx:DataGrid> > > </mx:Application> > > >