Código Flex :
<?xml version="1.0"?>
<!-- dpcontrols/DataGridPassData.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import mx.collections.*;
private var DGArray:Array = [
{Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},
{Artist:'Pavement', Album:'Brighten the Corners', Price:11.99}];
protected function B1_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
//DGArray.addItem([Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99]);
DGArray[3] = ['Pavement','Brighten the Corners', 11.99];
myGrid.dataProvider=DGArray;
}
]]>
</fx:Script>
<mx:DataGrid id="myGrid" width="350" height="200">
<mx:columns>
<mx:DataGridColumn dataField="Album" />
<mx:DataGridColumn dataField="Price" />
</mx:columns>
</mx:DataGrid>
<s:Button x="491" y="63" label="Button" id="B1" click="B1_clickHandler(event)"/>
</s:Application>Tengo un boton que realizar todo el trabajo incorporar al array un nuevo elemento, y visualiza ese array en la grilla, pero no se como incorporar el nuevo elemento.
