ParamQuery grid support forum

General Category => Bug Report => Topic started by: jim@solver.com on July 11, 2022, 11:52:46 pm

Title: Sorting of grouped data using non-group by column confusing
Post by: jim@solver.com on July 11, 2022, 11:52:46 pm
I am currently using version 8.3.0.

I have a grid with one grouped column and two date columns. When I click the header for date1 all of the data is sorted including the grouped column. When I click the header of date2 the data is only sorted within each group.

I checked your Grouped Rows demo https://www.paramquery.com/pro/demos/export (https://www.paramquery.com/pro/demos/export) and found the same behavior. When the "Freight" column header is clicked the "ShipCountry" column row order changes but when "Shipping Via", "Shipped Date" or "Shipping City" headers are clicked the "ShipCountry" retains its alphabetical sorting and the sorted column data is sorted with its group.

I checked the demo code and didn't find special sort configurations to cause this behavior. What is causing this difference in sort behavior?

I would like to configure my grid to behave like the "Freight" column unless the group by column has been sorted by the user.

Thanks for your help!
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: paramvir on July 12, 2022, 11:12:06 am
Jim

Difference between Freight and other columns is that Freight is a summary column and it's quite useful and makes sense to see a summary column sorted as a whole after applying grouping.

Other columns can be sorted as a whole either by removing grouping or by using Ctrl key along with click on header cell.
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: jim@solver.com on July 12, 2022, 08:58:55 pm
That is an interesting feature.

My date2 column is a summary column of nested JSON data so it gets its data from a a row template getter. Could that be affecting the behavior?

When I use the Ctrl-click on the header it does sort the groups also but when I Ctrl-click until the sort is removed the group sort does not return to its initial state.

Thanks for your help,

Jim
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: paramvir on July 13, 2022, 11:25:02 pm
1) Nested json data works the same way. Kindly share a jsfiddle if you want me to check.

2) That has been fixed in upcoming version.
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: jim@solver.com on August 11, 2022, 05:53:57 am
I waited for the 8.5.0 release before revisiting this issue. I am still having problems with sorting columns that display nested JSON even when there is a summary defined for the column. During my testing I also found that the nested JSON columns are not summarized properly.
I created this JSFiddle so you can see what is happening: https://jsfiddle.net/jhschmidt/rLbcn4ws/2/ (https://jsfiddle.net/jhschmidt/rLbcn4ws/2/)
While testing with the JSFiddle I discovered that the issue is caused by the group column being defined in the colModel. If the groupModel does not contain a column and the column is added after initialization the summaries are calculated correctly and sorting works as expected.

I hope this helps with this issue.

Thanks,
Jim
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: paramvir on August 12, 2022, 11:35:45 am
Jim

Thanks for pointing out the issue and jsfiddle. I'm able to reproduce the issue and have been looking into it.
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: jim@solver.com on August 13, 2022, 01:08:03 am
I did some debugging and found that the rowTemplate accessors are added to the row data in cRefresh.addRowIndx() which occurs after the row data is summarized by the call to self.groupData() in onDataReady on line 15996. The row data is extended in cRefresh.addRowIndx() by a call to pq.extendT() which on line 1189 tests for an undefined property. Unfortunately the property has already been assigned a value when the summary is created so the accessor to the nested JSON data is not assigned.

I hope this helps,
Jim

Code: [Select]
onDataReady: function() {
var self = this,
that = self.that,
GM = that.options.groupModel,
GMLen = GM.dataIndx.length;
if (GM.on) {
if (GMLen || GM.grandSummary) {
if (that._trigger("isSkipGroup") !== false) {
self.groupData();
self.buildCache()
}
that.iRefresh.addRowIndx();
self.refreshColumns();
if (GMLen) {
self.initcollapsed();
self.initmerge();
if (self.isCascade(GM)) {
self.cascadeInit()
}
}
} else {
self.refreshColumns()
}
self.setValCBox()
}
self.createHeader()
},
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: paramvir on September 05, 2022, 09:10:44 pm
This has been fixed in v8.6.0
Title: Re: Sorting of grouped data using non-group by column confusing
Post by: jim@solver.com on September 07, 2022, 03:10:33 am
I tested the 8.6.0 version and the summary data is now being calculated correctly and sorting is correct for nested JSON data. Thanks for the fix!