Search code examples
actionscript-3flex4flashbuilder4

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
        {

            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()
        }

Solution

  • This should work for you:

    this.changingData = null;