I have following jqGrid in my page
<sjg:grid id="reportGrid"
gridModel="gridModel"
autowidth="true"
reloadTopics="refreshGrid" gridview="true"
onGridCompleteTopics="gridLoadComplete"
onSuccessTopics="dataLoadCompleted"
navigator="true"
pager="true"
navigatorSearch="true"
navigatorSearchOptions="{multipleSearch:true}"
scroll="true"
rowNum="10000"
hoverrows="false"
groupColumnShow="false"
groupField="['field1','field2']"
href="webReport"
formIds="myform"
dataType="json"
loadonce="true" >
..........................
..........................
..........................
</sjg:grid>
and a button
<sj:a button="true"
buttonIcon="ui-icon-refresh"
buttonText="true"
onclick="reloadGridFunc();">
Submit
</sj:a>
and in JS I have this
function reloadGridFunc()
{
$("#reportGrid").jqGrid('setGridParam',{datatype:'json'});
$.publish("refreshGrid");
// $("#reportGrid")
// .jqGrid('setGridParam',{url:"userReport",datatype:"json"}).
trigger("reloadGrid");
}
$.subscribe('gridLoadComplete', function(event, data) {
// $("#reportGrid").jqGrid('clearGridData');
// $('#reportGrid').setGridParam({ page: 1, datatype: "json"})
// .trigger('reloadGrid');
// $("#reportGrid").trigger('reloadGrid');
});
$.subscribe('dataLoadCompleted', function(event, data) {
// $("#reportGrid").trigger('reloadGrid');
});
but what I am seeing is that the grid populates with new data but the grouping is not cleared; I have to press the reload button on bottom of the grid to refresh the grid, and after that the data representation looks fine.
I have a form in which a grid , anchor and other HTML elements exists, and according top these I select different criteria and click the button, the grid is populated and when I change the criteria the grid repopulating, but the old grouping is preserved. I have to press the reload button in grid to fix this.