I have build an infragistics webdatagrid in c# :
var columnOne = new BoundDataField();
columnOne.DataFieldName = "ColumnOne";
columnOne.Key = "columnOne";
columnOne.Header.Text = "columnOne";
var columnTwo = new BoundDataField();
columnTwo.DataFieldName = "ColumnTwo";
columnTwo.Key = "columnTwo";
columnTwo.Header.Text = "columnTwo";
WebDataGridObject.DataKeyFields = "ColumnOne";
WebDataGridObject.Columns.Add(columnOne);
WebDataGridObject.Columns.Add(columnTwo);
I would like from javascript to update the cell from the column two when something is typed in the cell from the column one.
For example, my user starts typing a value in cell at line 3 and column one, the cell at line and column two must be automatically updated with a constant value, like "updated".
To do that, I am a bit struggling, I have attach a lot of client events from my c#, and I think that the one usefull is the keydown :
WebDataGridObject.ClientEvents.MouseDown = "WebDataGridView_MouseDown";
WebDataGridObject.ClientEvents.KeyDown = "WebDataGridView_KeyDown";
WebDataGridObject.Behaviors.EditingCore.Behaviors.CellEditing.CellEditingClientEvents.EnteredEditMode = "enteredEditMode";
WebDataGridObject.Behaviors.EditingCore.Behaviors.CellEditing.CellEditingClientEvents.ExitedEditMode = "exitedEditMode";
I would like my js keydown event handler, getting the column key of the cell currently edited, and if it's equals to "columnOne", update the value of the cell at the same line and on column two. This is my js :
function WebDataGridView_KeyDown(webDataGrid, evntArgs) {
}
function WebDataGridView_MouseDown(webDataGrid, evntArgs) {
// this is where I am trying to get the column key of the currently edited cell
webDataGrid.get_behaviors().get_selection().get_selectedRowsResolved() [0].get_cell(3).get_text()
}
var gridRef;
var cellRef;
function enteredEditMode(grid, args) {
gridRef = grid;
cellRef = args.getCell();
if (cellRef._column._key === "headerName") {
alert('toto');
}
}
function exitedEditMode(grid, args) {
gridRef = null;
cellRef = null;
}