Reputation: 113
How can i add and remove rows in datagrid using check box`
[Bindable]public var _files:Array = new Array();
private function init():void{
_files = new Array();
for(var j:int=0;j<10;j++){
_files[j] = {name:_files0[j],type:_files1[j],size:_files2[j]};
}
}
private function setCheckBoxStatus(checkBoxNum:Number):void{
if(this["chkBox"+checkBoxNum].selected==true){
_files.removeItemAt(checkBoxNum);
}else{
_files.addItemAt(checkBoxNum);
}
}
]]>
</mx:Script>
` in the above code if i select check box i need to add row if i deselect i need to remove the row how can i do that ? please help me! Thanks in Advance.
Upvotes: 0
Views: 301
Reputation: 6565
Simple Arrays do not have the same binding capabilities as an ArrayCollection
or other more advanced collection. Essentially, when you remove the item the DataGrid doesn't get any notification to update itself.
Upvotes: 2