import mx.controls.TextInput;
import mx.events.DataGridEvent;
import mx.events.DataGridEventReason;
import mx.formatters.NumberFormatter;
import mx.collections.ArrayCollection;
[Bindable]
private var initDG:ArrayCollection = new ArrayCollection([
{Artist:'A', Album:'AA',Price:11.99},
{Artist:'B', Album:'BB',Price:11.99 }
]);
private var myFormatter:NumberFormatter=new NumberFormatter();
public function formatData(event:DataGridEvent):void {
if (event.reason == DataGridEventReason.CANCELLED){
return;
}
var newData:String= TextInput(event.currentTarget.itemEditorInstance).text;
if(newData == ""){
event.preventDefault();
TextInput(myGrid.itemEditorInstance).errorString="Enter a valid string.";
}
}
itemEditEnd="formatData(event);">