title: jqgrid set cell editable false dynamically on condition
body: <p>I have a <code>jqgrid</code> populated by some fields. I want some of the cells to be</p>
  
  <pre><code>editable:true
  </code></pre>
  
  <p>or</p>
  
  <pre><code>editable:false
  </code></pre>
  
  <p>based on a condition</p>
  
  <p>Here's my function (EDITED):</p>
  
  <pre><code>var grid = $("#mygrid");
  var getColumnIndexByName = function(gr,columnName) {
  var cm = gr.jqGrid('getGridParam','colModel');
  for (var i=0,l=cm.length; i&lt;l; i++) {
      if (cm[i].name===columnName) {
          return i; // return the index
      }
  }
  return -1;
  };
  function abilitaDisabilitaEditRecord() {
  var pos=getColumnIndexByName(grid,'descrizione');
  var pos2=getColumnIndexByName(grid,'endDate');
  var allIds = $('#mygrid').jqGrid('getDataIDs');
  var cells = $("tbody &gt; tr.jqgrow &gt; td:nth-child("+(pos+1)+")",grid[0]);
  var cells2 = $("tbody &gt; tr.jqgrow &gt; td:nth-child("+(pos2+1)+")",grid[0]);
  for (var i = 0; i &lt; allIds.length; i++) {
      for (var j=0; j&lt;cells.length; j++) {
          var cell = $(cells[j]);
          var cell2 = $(cells2[j]);
      var checkDataFine = $('#mygrid').jqGrid('getCell', allIds[i], 'date');
      if (!checkDataFine==false) {
          cell.addClass('not-editable-cell');
          cell2.addClass('not-editable-cell');
          }   
      }
  }
  }
  </code></pre>