title: jqGrid and Dynamic Grouping
body: <p>I'm working on some dynamic grouping of my jqGrid, per the example posted at:  <a href="http://www.trirand.com/blog/jqgrid/jqgrid.html" rel="nofollow">http://www.trirand.com/blog/jqgrid/jqgrid.html</a>  (see the last section in the tree nav: 'Grouping: Dynamically Change Grouping'.</p>
  
  <p>I can make my grid dynamically change the grouping IFF the grid initially has a grouping column.  However, this is not the desired behaviour.  Initially the grid needs to be ungrouped and allow the user to group items if they choose.</p>
  
  <p>Code follows:</p>
  
  <pre><code>function onGroupByChanged(){
      var vl = $('#lstGroupBy').val();
      if(vl) {
          if(vl == "clear") {
              $("#refData").jqGrid('groupingRemove',true);
          } else {
              $("#refData").jqGrid('groupingGroupBy', vl);
              $("#refData").jqGrid('setGridParam', { grouping:true });
              $('#refData').trigger('reloadGrid');
          }
      }   
  }
  </code></pre>
  
  <p>When I set the groupingGroupBy to the column name (contained in 'vl'), I receive this error in FireBug: can't convert null to object in jQuery min 1.4.2</p>
  
  <p>I have even swapped the order of my calls to groupingGroupBy and setting grouping to true.</p>
  
  <p>Anyone have an idea?  I'm stuck and have spent about two hours on this already.</p>
  
  <p>Thanks,
  Randall</p>