By default, if a jqGrid cell is editable, single click on that cell changes it to edit mode. Is there any way I can make it edit on a double click instead? It would make it easier to do row-level operations such as deleting, as all the columns in my grid are editable.
A:
Yes, you can use the ondblClickRow
event to capture a double-click.
Here is a simple example to get you started:
ondblClickRow: function(){
var row_id = $("#grid").getGridParam('selrow');
jQuery('#grid').editRow(row_id, true);
}
Justin Ethier
2010-07-19 17:48:25
Thanks, but this is not quite what I had in mind. Looking at this code, it appears that this would bring up the form to edit the contents of an entire row, whereas I want to do inline editing of a single cell. Also, how would I disable the cell editing on a single click, while still retaining the ability to select the row with a single click?
Kyle
2010-07-21 11:58:17
`editRow` is for inline editing, not form editing. Also, in my grids I needed to explicitly call `editRow` from the `onSelectRow` event to enable editing via single-click. If you simply remove this code you will have disabled single-click. Just keep in mind that double-clicking to edit may not be intuitive to your users...
Justin Ethier
2010-07-21 13:19:14
Do you mean you removed the code from the jqGrid code itself? Also, you may be correct, but I don't really think that even single-clicking on text for editing is all that intuitive. At least in apps like Excel, editing a cell requires a double-click, so it's not without precedent. Thoughts?
Kyle
2010-09-16 12:19:03