How can I use Actionscript to clear data from datagrid?
I have a flex datagrid that I would like to remove contents from after a button click event. If I use the removeItemAt(myGrid.selectedIndex) method it works fine but the removeAll() method does nothing. The addData() function you see here takes textinput values and sends them to the datagrid.
[Bindable]
public var originalData:ArrayCollection;
[Bindable]
public var changingData:ArrayCollection = new ArrayCollection();
public function addData(e:MouseEvent):void
{
开发者_Go百科 this.originalData = new ArrayCollection( );
var obj:Object = new Object( );
obj.Value = parseInt(myText.text)
originalData.addItem( obj );
this.changingData.addItem(obj);
}
public function clearList():void
{
this.changingData.removeAll()
}
This should work for you:
this.changingData = null;
精彩评论