title: JQGrid with dynamic column: cellattr does not work
body: <p>I have built my JQGrid table with dynamic column in this way (ajax call) :</p>
  
  <pre><code>$.ajax(
  {
      type: "POST",
      url: "Scripts/GetSummaryInformation.php",
      data: { domain: "&lt;?php echo $domain; ?&gt;", etc. },
      dataType: "json",
      success: function(result)
      {
          var colD = result.gridModel;
          var colN = result.colNames;
          var colM = result.colModel;
          var colSpan = result.colSpan;
  
          jQuery("#FinalRatingList&lt;?php echo $domain; ?&gt;&lt;?php echo $companyID; ?&gt;").jqGrid({
               jsonReader : { repeatitems: false, root:"dataset", cell: "cell", id: "0" },
               url: 'Scripts/GetSummaryInformation.php',
               datatype: 'json',
               mtype: 'POST',
               postData : { domain: "&lt;?php echo $domain; ?&gt;", etc.},
          datastr : colD,
          colNames:colN,
          colModel :colM,
          height: 'auto',
          pager: jQuery('#FinalRatingListPager'),
          caption:"Final Rating",
          loadComplete: function(data){
              console.info("FinalRatingList Success");
              notyMsg ("loadComplete", "info");
      },
  ...
  </code></pre>
  
  <p>and it works fine :)</p>
  
  <p>When I create a column in the PHP file like using the <strong>cellattr</strong></p>
  
  <pre><code>$response-&gt;colModel[$colMod++] = array ('name'=&gt;'DIR'.$projectName, 'index'=&gt;'DIR'.$projectName, 'width'=&gt;'40', "cellattr"=&gt;"rowSetting" );
  </code></pre>
  
  <p>there is absolutely no effect at all.
  Even when I put code directly in the cellattr like this</p>
  
  <pre><code>"cellattr"=&gt;"function( rowId, value, rowObject, colModel, arrData) { return ' style=\"background:orange\"'}" );
  </code></pre>
  
  <p>Does anyone have faced or know the solution to this problem?</p>
  
  <p>Thanks in advance for your collaboration</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks Oleg. It worked greatly for cellattr and for template (which is a really good advice).</p>
  
  <p>For those who are interested here is the code:</p>
  
  <pre><code>var rowSetting = function (rowId, val, rawObject, cm) {
      return 'style="background-color: orange;';
  };
  var cellattrMapping = {
      "rowTemplate": rowTemplate
  };
  
  var rowTemplate = {
      width:120,
      cellattr: rowSetting
  };
  </code></pre>
  
  <p><em>AJAX CALL</em></p>
  
  <pre><code>success: function(result)
  {
       ...
       for (i=0; i&lt;colM.length; i++) {
           cm = colM[i];
           if (cm.hasOwnProperty("template") &amp;&amp; cellattrMapping.hasOwnProperty(cm.template))
           {
               cm.template = cellattrMapping[cm.template];
           }
  </code></pre>