Datagrid cell validation in Action script
take datagrid with property editable=”true”
public var EditingRowIndex:int;private function testItemEditEnd(event:AdvancedDataGridEvent):void
{
EditingcolIndex=event.columnIndex;
//Previous column index
ComparecolIndex=event.columnIndex -1;
EditingRowIndex=event.rowIndex;
colReference=genricDG.columns[EditingcolIndex];
//Gives column name for Comapre Column
comReference=genricDG.columns[ComparecolIndex]["dataField"];
var CompareValue:int=genricDG.dataProvider[EditingRowIndex][comReference];
var EditedValue:int = parseInt(TextInput(event.currentTarget.itemEditorInstance).text);
if(CompareValue > EditedValue)
{
//no validation coz satisfies the condition
//total.text =String(parseInt(total.text) + EditedValue);
}
else
{
//PREVENT DEFAUL WILL PERSIST VALUE OF DATAGRID CELL
event.preventDefault();
//VALIDATION AFTER CONVERTIN itemEditorInstance INTO TextIput
TextInput(event.currentTarget.itemEditorInstance).errorString =
“Value Must be Less than or qual o” + comReference;
}
}


This works only when data grid is not vertically scrollable. If data grid has more data then the row count, the editor text input move along the scroll, and after editing it change the data of some other row.