Here's what I've done in the past...

// add this in your init code...
myDataGrid.addEventListener(ListEvent.ITEM_EDIT_END, editEnd);



private function editEnd(evt:DataGridEvent):void{
                                
// get a reference to the datagrid
var grid:DataGrid = evt.target as DataGrid;

// get a reference to the name of the property in the
// underlying object corresponding to the cell that's being edited
var field:String = evt.dataField;

// get a reference to the row number (the index in the 
// dataprovider of the row that's being edited)
var row:Number = Number(evt.rowIndex);

// get a reference to the column number of
// the cell that's being edited
var col:int = evt.columnIndex;

                        
if (grid != null){
                                                        
var oldValue:String = String(grid.dataProvider.getItemAt(row)[field]);

var newValue:String = 
String(grid.itemEditorInstance[grid.columns[col].editorDataField]);
                
var rowData:XML = XML(grid.dataProvider.getItemAt(row)[0]);
                          
// check if the value has changed
if (newValue == oldValue){
// nothing has changed...
    return;
}


// something has changed...
// do something...
// you could prevent the change if you want
// or do some validation
// or just return and the data move on to the dp.
}
                
}


--- In [email protected], Dan Pride <danielpr...@...> wrote:
>
> Looking for suggestions on how to approach an issue.
> 
> I want to write a function to compare the current value of a text field with 
> the value of the field in the selected row of the dataGrid. I want to use the 
> function as a focus-out handler on every text input.
> 
> Obviously I don't want to rewrite this for each and every field but I did not 
> see a functional similarity to a pointer in actionscript or did I just miss 
> it?
> 
> This is for the awesome Flashbuilder 4,... I have a text input for every 
> field in the value object and want to compare each to the selectedItem for 
> the dataGrid and kick some stuff if it does not match.
> Thanks
> Dan Pride
>


Reply via email to