first, get the line number
Copy Code code as follows:
var findex:number = Math.floor (dg.contentmousey/dg.rowheight)-1 + dg.verticalscrollposition;
Dg.contentmousey is the height of the local coordinate system of the mouse in relation to the DataGrid
Dg.rowheight is the row height of the DataGrid, the Math.floor function is to truncate the decimal point
Verticalscrollposition is the number of rows to scroll down if the DataGrid has scroll bars. So Findex is the number of rows the mouse is in.
Error handling if (findex<0 | | findex>=dg.verticalscrollposition+dg.rowcount-1)//line number is less than 0 o'clock and greater than the total number of DataGrid rows
{
Don't do anything.
} else {
.............
}
second, get the column number
Copy Code code as follows:
var _editcolumn:datagridcolumn=dgrainrealtime.columns[ Event.columnindex];
var editvalue:string=dgrainrealtime.itemeditorinstance[_editcolumn.editordatafield];//Get the edited rainfall value
var _ Editvalue:int=int (EditValue);
Var _row:int=dgrainrealtime.editeditemposition.rowindex;
Var _column:int=dgrainrealtime.editeditemposition.columnindex;
var col:datagridcolumn=dgrainrealtime.columns[_column-1];
var devicename:string=dgrainrealtime.dataprovider.getitemat (_row) [Col.datafield];//The site name of the edited rainfall value obtained