Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
755 views
in Technique[技术] by (71.8m points)

jquery - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...