xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
initialize="initData()">
import mx.collections.*;
private var DGArray:Array = [
{Artist:'Pavement', Album:'Charred Walls', Price:11.99},
{Artist:'Pavement', Album:'Good For You', Price:11.99}];
[Bindable]
public var initDG:ArrayCollection;
//Initialize initDG ArrayCollection variable from the Array.
public function initData():void {
initDG=new ArrayCollection(DGArray);
}
public function addNewItem():void {
var o:Object;
o = {Artist:'Pavement', Album:'Tradio', Price:11.99};
initDG.addItem(o);
callLater(focusNewRow);
}
public function focusNewRow():void {
myGrid.editedItemPosition = {columnIndex:0,rowIndex:myGrid.dataProvider.length-1};
}
dataProvider="{initDG}" editable="true">