Hi all, I just want to check and uncheck a checkbox in a datagrid. What I do is to add or remove from the selected's collection. But I got an error index when removing. Futhermore, the checked item change! when I move the datagrid scroll bar. This is my code,
<mx:DataGridColumn headerText="checked" editable="false" rendererIsEditor="true"> <mx:itemRenderer> <mx:Component> <mx:CheckBox click="checked(this.selected, data as ComunidadVO)" > <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import gestion.vo.ComunidadVO; import gestion.model.GestionModelLocator; public function checked(selected:Boolean, comunidadVO:ComunidadVO):void{ var locaciones:ArrayCollection=GestionModelLocator.getInstance().locationChecked; if (selected==true){ locaciones.addItem(comunidadVO); }else{ var index:int=locaciones.getItemIndex(comunidadVO); locaciones.removeItemAt(index); } } ]]> </mx:Script> </mx:CheckBox> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus