Looking for a sample app using webdatagrid. All it has is a sql datasource using one cell. I need the first cell to be in editmode on page load and on the enter key down put the next cell in edit mode. thanks
Hello mburk2 ,
I’m glad to hear this solved your issue. If you have any additional questions or concerns please let me know.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
Thanks so much for the help. I had been trying to use the be behaviors events not the grid.
Works great.
You can manually force a cell in edit mode using the enterEditMode method of the cell editing behavior. For example:
var editing= sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing();
editing.enterEditMode(cell);
To enter edit mode on the initial load you can handle the Initialize event and in it enter edit mode for the first cell. For example:
function wdg_init(sender,e) {
var firstCell = sender.get_rows().get_row(0).get_cell(0);
editing.enterEditMode(firstCell);
editedCell = firstCell;
}
By default on “Enter” key the cell exits edit mode. In order to force it to enter edit mode for the next cell you can handle the key down event and change the current edited cell programmatically. For example:
function wdg_keyDown(sender,e) {
if (e.get_browserEvent().keyCode == 13) {
//check if Enter key has been hit
var editing = sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing();
var currentCellInEditMode = editedCell;
var cellIndex=currentCellInEditMode.get_index();
var nextCell;
if(cellIndex+1<sender.get_columns().get_length()) {
//check whether this is the last cell for the column
nextCell = currentCellInEditMode.get_row().get_cell(cellIndex+1);
else {
//if it's the last cell move to the next row
var nextRow=sender.get_rows().get_row(currentCellInEditMode.get_row().get_index()+1);
nextCell=nextRow.get_cell(0);
editing.enterEditMode(nextCell);
editedCell = nextCell;
Please refer to the attached sample and let me know if you have any questions.