I've noticed that multi grouping in JQGrid elicits rows sorting to be rearranged inline once the list of values is retrieved through ajax getJSon(). Sometimes the reordering splits groups of the same elements in more than one group, as it should be.
I guess the solution is to avoid client side re-sorting of JQGrid rows, with the aim to definitively reuse the same order given inside the JSON without changes --- as returned by the server.
I'm using the following configuration :
jq("#myGrid").jqGrid({
datatype: 'local',
data: myvar.detail, // a well formatted json locally stored
colNames: [ ....],
colModel: [
{name:'nome_attr',index:'nome_attr', sorttype: function () {return 1;}, editable:true, editrules:{required:true}, editoptions:{size:27}, align:'center'},
{name:'desc_attr', index:'desc_attr', sorttype: function () {return 1;}, editable:true, editrules:{required:false}, edittype: "textarea",editoptions:{rows:5, cols:25}, hidden:true},
{name:'valore',index:'valore', sorttype: function () {return 1;},editable:true, editrules:{required:false}, editoptions:{size:30}, width:120},
....
],
loadonce: false, // to dis-able sorting on client side
sortable: false,
grouping:true,
groupingView : {
groupField : ['nome_attr', 'valore'],
groupColumnShow: [false,false],
groupText : ['{0}'],
groupCollapse: true,
groupDataSorted: false,
groupSorted: false,
groupOrder: false
}
});
Notice (1) I'm already using the workaround to disable the sort type
sorttype: function () {return 1;}
as described here, and that in "#myGrid"
is a sub-grid, where the datatype: local
, means the rows have been previously retrieved in the container grid.
Does anybody knows which is the configuration of the colModel
attribute and the groupingView
parameters to be set in order to avoid in-line re-sorting in case of Multi Grouping ?
thanks in advance,
Michele