
Код:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:DataGrid width="500">
<mx:dataProvider>
<mx:ArrayCollection>
<mx:Object artist="Fused" album="Audio" price="18.99" />
<mx:Object artist="Squarepusher" album="Hello Everything" price="16.98"/>
<mx:Object artist="Ellen Allien" album="Berlinette" price="16.98"/>
<mx:Object artist="Vargo" album="Beauty" price="16.98"/>
<mx:Object artist="Orbital" album="In Sides" price="11.98"/>
<mx:Object artist="Prefuse 73" album="One Word Extinguisher" price="16.98"/>
</mx:ArrayCollection>
</mx:dataProvider>
<mx:columns>
<mx:DataGridColumn dataField="artist" headerText="Artist" />
<mx:DataGridColumn dataField="album" headerText="Album" />
<mx:DataGridColumn dataField="price" headerText="Price" />
<mx:DataGridColumn headerText="" editable="false" width="100" itemRenderer="renderers.Renderer"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
renderers/Renderer.mxml:

Код:
<?xml version="1.0" ?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
import mx.collections.ArrayCollection;
import mx.controls.dataGridClasses.DataGridBase;
private function clickHandler(event:MouseEvent):void
{
var dataGrid:DataGridBase = DataGridBase(this.owner);
var arrayCollection:ArrayCollection = dataGrid.dataProvider as ArrayCollection;
arrayCollection.removeItemAt(dataGrid.selectedIndex);
}
]]>
</mx:Script>
<mx:Button label="delete" click="clickHandler(event)" />
</mx:HBox>