Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll recommend you to use so named "Inline Editing" for row editing. The most advantage of this method, that it is very intuitive and the user. You can see how it works on the demo page <a href="http://trirand.com/blog/jqgrid/jqgrid.html" rel="noreferrer">http://trirand.com/blog/jqgrid/jqgrid.html</a>. Choose on this demo "Row Editing" and then "Using Events" or "Input types" on the left tree part. With this method you can implement any custom verification whether the selected row should be allowed to be edited or not inside of the event handle <code>onSelectRow</code> or <code>ondblClickRow</code>. If you allow editing, then you call <code>editRow</code> method of jqGrid. This method creates input controls for all editable columns and the user can modify the row values in a natural way. The modifications will be saved if the user press "enter" key or canceled on "esc" key.</p> <p>I personally prefer to implement calling of <code>editRow</code> method inside of <code>ondblClickRow</code> event handler. So the user can continue selecting of rows like usual and can use double click for the row editing. The pseudo code will look like folowing:</p> <pre><code>var lastSel = -1; var isRowEditable = function (id) { // implement your criteria here return true; }; var grid = jQuery('#list').jqGrid({ // ... ondblClickRow: function(id, ri, ci) { if (isRowEditable(id)) { // edit the row and save it on press "enter" key grid.jqGrid('editRow',id,true); } }, onSelectRow: function(id) { if (id &amp;&amp; id !== lastSel) { // cancel editing of the previous selected row if it was in editing state. // jqGrid hold intern savedRow array inside of jqGrid object, // so it is safe to call restoreRow method with any id parameter // if jqGrid not in editing state grid.jqGrid('restoreRow',lastSel); lastSel = id; } }, pager: '#pager' }).jqGrid('navGrid','#pager',{edit:false}); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload