title: How do I refresh the grid after grouping in jQgrid?
body: <p>This is the javascript part from my jqgrid. The main ideea is to make a grouping  after a value from a dropdown, which I select. In my case there are two option value (<strong>-1</strong> and "<strong>cerinte</strong>"). When the value is -1 I don't want to make any grouping, but when I select the cerinte I want to make a gropuing after "<strong>cerinte</strong>". The problem is I have to press the F5 button(to refresh the page) to make it works. After When I refreshed the page it works perfectly. Whan can i do to make this work without refreshing the page ???? Thx
  I forgot to mention that i use hash links: my link looks like: 
  <strong>...../timp#?period=2014-06-11&amp;ddProject=-1&amp;ddUser=48&amp;ddActivity=-1&amp;txTask=&amp;ddGrupare=-1&amp;page=1&amp;sortname=date&amp;sortorder=asc</strong></p>
  
  <pre><code>window.onhashchange = function() {
          jQuery("#list2").trigger("reloadGrid");
      }
      var url = $.url(window.location.href.replace("#",""));
      var page = url.param("page");
      var sortname = url.param("sortname");
      var sortorder = url.param("sortorder");
      var group_check = url.param("ddGrupare");
      $("#ddGrupare &gt; option").each(function() {  // se selecteaza option dupa care s-a facut gruparea, valorea fiind selectata va fi atribuita la parametrul URL
          if(group_check == this.value){
              $(this).attr("selected","selected");
          }
      }); 
      if (group_check == "cerinte" ){
          group_check = true;
      }else{
          group_check = false;
      }
  
      jQuery("#list2").jqGrid({
          url:'/timp/json/',      
          datatype: "json",
          colNames:['Data si ora','Durata','Utilizator','Proiect: task', 'Descriere lucru','',''],
          colModel:[
              {name:'Data',index:'date',width:'11%'},
              {name:'Durata',index:'duration',width:'4%'},
              {name:'Responsabil',index:'username',width:'8%'},           
              {name:'Proiect',index:'projectname',width:'22%'},
              {name:'Descriere',index:'description',width:'40%'},
              {name:' ',index:'remove', sortable:false, width:'3%'},
              {name:'cerinte',index:'cerinte', hidden: true, sortable:false, width:'3%'}
          ],
          rowNum:15,      
          sortname: 'date',
          viewrecords: true,
          sortorder: "asc",
          caption:"",
          autowidth: true,
          shrinkToFit: true,
          width: '100%',
          height: '100%',
          altRows: true,
          altClass: '',
          loadComplete:function(request){
  
              //alert("Load complete");
              showRecorder();
              $("#paging").html(request.userdata.pager);
              $("#total").html(request.userdata.suma);
              $(".numb").click(function() { 
                  $("#list2").trigger("reloadGrid", [{page:$(this).text()}]);
              });
              registerOverlay();
              doPagination();
              showConfirm();
              formatUrl();
              setBackUrl();
              $("#empty").hide(); 
              if(request.total == 0)
                  $("#empty").show();
  
              $("tr td b").each(function(){
                  if ($(this).text() == "null"){
                      $(this).text("Taskuri neasociate cu cerinte")
                  }
              });
          }, 
  
          beforeRequest:function() {
  
              jQuery("#list2").jqGrid('hideCol', ["cerinte"]);
              //parseUrl();
              var taskname = jQuery("#txTask").val();     
              var projectid = jQuery("#ddProject").val();
              var userid = jQuery("#ddUser").val();
              var type = jQuery("#ddActivity").val();
              var period = $("#period").val().split(" - ");
              var startdate = period.length &gt; 0 ? period[0] : '';
              var enddate = period.length &gt; 1 ? period[1] : '';
              jQuery("#list2").jqGrid('setGridParam',{url:"/timp/json/?projectid="+projectid+"&amp;userid="+userid+"&amp;type="+type+"&amp;taskname="+taskname+"&amp;startdate="+startdate+"&amp;enddate="+enddate});
          },
          forceFit : true,        
          grouping:group_check,   // se seteaza dc enable/disable grupare
          groupingView : {
              groupField : ['cerinte'],
              groupSummary : [true],
              groupColumnShow : [true],
              groupText : ['&lt;b&gt;{0}&lt;/b&gt;'],
              groupCollapse : false,
              groupOrder: ['asc'],
              groupHeader: [true],
          }
      });
          /*================================================================================*/
          /*                                Grupare                                         */
          /*================================================================================*/
  
          $("#ddGrupare").change(function () {
              var groupingName = $(this).val();
              url = $("#list2").jqGrid('getGridParam','url');
              url = url+"&amp;ddGrupare="+groupingName;
              jQuery("#list2").jqGrid('setGridParam',{url:url});
              if (groupingName != '-1') {
                  $("#list2").jqGrid('groupingGroupBy', groupingName);
                  $("thead").first().hide();
  
              }else{
                  $('#list2').jqGrid('groupingRemove');
                  $("thead").first().show();
              } 
              jQuery("#list2").trigger("reloadGrid"); 
          });
  </code></pre>