Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit the selected cell on jqGrid

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.

like image 981
Juan Francisco Avatar asked Jun 30 '11 14:06

Juan Francisco


1 Answers

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.

like image 167
Oleg Avatar answered Oct 05 '22 07:10

Oleg