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.
            Asked
            
        
        
            Active
            
        
            Viewed 2.5k times
        
    2 Answers
8
            
            
        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
        
- 131,333
 - 52
 - 229
 - 284
 
- 
                    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 Jul 21 '10 at 11:58
 - 
                    `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 Jul 21 '10 at 13:19
 - 
                    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 Sep 16 '10 at 12:19
 
2
            
            
        I got the answer. You only need to place the code on the jqgrid properties For example:
width: 800,
        height: 200,
        caption:"   .:: Captura de Datos ::.",
        addedrow: "last",
        ondblClickRow: function (rowid, iRow,iCol) {
            alert('Doble Click');
            //jQuery("#TBLReporte").editCell(iRow, iCol, true);
        }
        Daniel Azamar
        
- 672
 - 7
 - 8