How to edit the selected cell on jqGrid

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.

Leave a Comment