ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: nzxgq0 on September 01, 2021, 10:38:04 am
-
Hello there,
we want to sort the grp column by default.
groupModel: {
checkbox: true,
checkboxHead: true,
on: true,
pivot: false, //pivotMode
summaryInTitleRow: 'all', //to display summary in the title row.
header: false, //hide grouping toolbar.
grandSummary: true,
titleInFirstCol: true,
titleIndx: 'grp',
fixCols: false,
dataIndx: ['Item'],
groupCols: [], //grouping along column axis.
collapsed: [true, true],
agg: {
Count: "sum"
},
showSummary: [false], //to display summary at end of every group.
title: [
"{0} ({1})",
"{0} - {1}"
],
summaryTitle: {
sum: ""
} },
sortModel: {
sorter: [{ dataIndx: 'grp', dir: 'up' }],
space: true,
ignoreCase: true,
multiKey: null,
single: false
}
However it is not working. It shows the small triangle but actually it is not sorting.
we also want to keep the group sorted at the pivot mode. Still no luck.
If we choose another column other than the "grp" column - such as the Item column in the example, it works.
Any idea? thanks.
-
Please check the image attached
-
Which version of pqgrid you are using? Please try calling sort method in complete event.
https://paramquery.com/pro/api#method-sort
https://paramquery.com/pro/api#event-complete
-
Thanks. I am using Pro 8.0.1.
Your approach by sorting the data inside the complete event is working at the first page load.
When updating the group by adding/removing columns into/from the row group, the sorting is gone.
Any idea to ensure the sort of the group?
Note the screenshots are not well ordered. See the FirstLoad, 2.AddStageToGroup then 3.SecondLevelNotSorted.
By the way, I tried "this.sort()" inside the groupOption event, but it didn't help.
-
Please use groupChange event instead of groupOption event.
groupChange: function(){
this.sort();
}
Try this if the above doesn't work
groupChange: function(){
var grid = this;
setTimeout(function(){
grid.sort();
});
}
-
Please use groupChange event instead of groupOption event.
groupChange: function(){
this.sort();
}
Try this if the above doesn't work
groupChange: function(){
var grid = this;
setTimeout(function(){
grid.sort();
});
}
Hi paramvir, it looks the groupChange event is not fired when dragging and dropping a column on the toolPanel but the groupOption is.
I tried your setTimeout method in groupOption and it worked. Thanks.