title: Jqgrid how to retain cellattr conditional formatting while the datatype is local (or loadonce: true)?
body: <p>I have a jqgrid load a large amount of rows (in 1000s) with loadonce:true option. The user will operate on the data locally after the jqgrid is loaded. I also have a conditional formating on one of the column with somthing looks like this</p>
  
  <pre><code> cellattr: function(rowId, cellValue, rawObject, cm, rdata) {
       if (rawObject[0]=='Stale'){
      return ' class="stale-highlight"';
       } else if (rawObject[0]=='Not Stale') {
      return ' class="notstale-highlight"';
       } 
   }
  </code></pre>
  
  <p>It works fine except the conditionall formatting will be lost as soon as the user does
  sort, filter, etc.</p>
  
  <p>I know this may be related to the loadonce option which changes the datatype to local after the grid is loaded. What can I do to allow the user operate operate on the data without polling the servrr but still retains the conditional formating?</p>
  
  <p>Thanks
  Casbby</p>
  
  <p>**</p>
  
  <h2>Update:</h2>
  
  <p>**</p>
  
  <p>I found the problem. Hopefully it can be useful to others.</p>
  
  <p>To reduce the data size, I use this json format:</p>
  
  <pre><code>{"rows":[{"id":"1","cell":["Not Stale","xxxx","2012-10-16 14:20:59",
                             "110517853","10797445","2012-10-17 08:29:51",
                             "xxxx","2012-10-17 08:33:02", "xxxx",
                             "105954724","xxxxxx","11111.0000",
                             "10000000.0000","10000000.0000"]}]
   ,"page":1,"total":1,"records":"2"} 
  </code></pre>
  
  <p>Three is no column name presented in the json. Hence initially when the grid is loaded the rawObject parameter used in cellattr is an array of value (corresponsing to the column). after the grid is loaded, the rawObject became an object. it contains pairs of column_name:column_value.</p>
  
  <p>Therefore my origianl code will only work during the initial grid load.</p>
  
  <pre><code>cellattr: function(rowId, cellValue, rawObject, cm, rdata) {
       if (rawObject[0]=='Stale'){
        return ' class="stale-highlight"';
        } else if (rawObject[0]=='Not Stale') {
         return ' class="notstale-highlight"';
     } 
  }
  </code></pre>
  
  <p>To fix this problem, I can see two options:</p>
  
  <pre><code>use the column_name:column_value pairs in the json object and change the cellattr code to reference the rawObject.column_name.
  </code></pre>
  
  <p>or</p>
  
  <pre><code>add extra logic to check rawObject.column_name in the cellattr function. it may be less efficient programmingwise but sometime changing input is not that easy
  
      cellattr: function(rowId, cellValue, rawObject, cm, rdata) 
      { if   (rawObject[0]=='Stale' || rawObject.column_name=='Stale')
         { return ' class="stale-highlight"'; } 
       else if (rawObject[0]=='Not Stale' || rawObject.column_name=='Not Stale') 
         { return ' class="notstale-highlight"'; }
  </code></pre>
  
  <p>Thanks Casbby </p>