How do I get a reference to the grid cell which is being edited, when the keydown event of the default numeric editor fires?
Roland
Thanks for the post. I found it very useful in my implementation.
Hit the wrong button there, sorry.
But if you're using more than one grid then do this:
var grid = $find("<%=WebDataGrid1.ClientID%>");
Hey Roland,
This isn't too much of a problem. What you can do is attach event handlers to entered and exited edit mode to log and clear the grid & cell. Just attach the same handlers for both grids.
var gridRef; var cellRef; function enteredEditMode(grid, args) { gridRef = grid; cellRef = args.getCell(); } function exitedEditMode(grid, args) { gridRef = null; cellRef = null; }
<ig:CellEditing> <CellEditingClientEvents EnteredEditMode="enteredEditMode" ExitedEditMode="exitedEditMode" /> </ig:CellEditing>
This will handle cell editing. If you have row adding or filtering on, you would need to attach handlers there. Then, in you keydown event, I would just check that the gridRef or cellRef is not null before attempting to use those variables. Let us know if this works.
-Dave
David,
I cannot use $find("WebDataGrid1"), because I have two grids. Is there an other way to get a reference to the grid being edited, or the edited cell?
Thanks in advance,
This isn't too difficult. Here is some code you can use.
var grid = $find("WebDataGrid1"); var editing = grid.get_behaviors().get_editingCore().get_behaviors().get_cellEditing(); var editCell = editing.get_cellInEditMode();
regards,
David Young