I'm using inline editing with jqGrid, but when I select a cell, the cursor is set in the first column of the row, but I'd like to know if there is any way to edit the current cell I have clicked on, instead of the first row.
Thanks in advance.
I'm using inline editing with jqGrid, but when I select a cell, the cursor is set in the first column of the row, but I'd like to know if there is any way to edit the current cell I have clicked on, instead of the first row.
Thanks in advance.
Very good point!
I personally prefer to use ondblClickRow event handler to start the editing mode. So you can use oneditfunc
parameter of the editRow:
ondblClickRow: function(rowid,iRow,iCol,e) {
grid.jqGrid('editRow',rowid,true,function(){
$("input, select",e.target).focus();
});
return;
}
or just place the like of code which set the focus after the call of editRow
:
ondblClickRow: function(rowid,iRow,iCol,e) {
grid.jqGrid('editRow',rowid,true);
$("input, select",e.target).focus();
return;
}
See the corresponding demo here.
focusField
parameter. If you read any old answer on the stackoverflow that you should understand that it describes the state at the time or writing the answer (about 4 years ago). You can't expect that one update all previous answers with the new information based on every new release of jqGrid. Even the update of the documentation is a problem because not all users uses the latest version. Moreover jqGrid is free and you can't expect that somebody invest a lot of his time in editing information for other. Which fork and which version of jqGrid you use now? –
Convoke © 2022 - 2024 — McMap. All rights reserved.