ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: 徐雪峰 on July 24, 2020, 05:09:02 pm

Title: how to sort the pivot columns
Post by: 徐雪峰 on July 24, 2020, 05:09:02 pm
i have a data array like the under code:
day,   year,  brand, sale
'day1',2019,'A1',1000
'day1',2020,'A1' ,2000
'day2',2019,'A2',3000
'day2',2020,'A2',4000
'day1',2019','日合计',4000
'day2','2020','日合计',6000
when my groupcols is brand,year,i want the '日合计' groupcol is at the last.
what should i do?

Title: Re: how to sort the pivot columns
Post by: 徐雪峰 on July 24, 2020, 05:42:44 pm
how to sort the pivot columns,or how to set a pivot column to the last position?
Title: Re: how to sort the pivot columns
Post by: paramvir on July 27, 2020, 08:29:39 am
You need to define colModel and use pivotSortFn on the column bound to '日合计' data to sort the group cols.

https://paramquery.com/pro/api#option-column-pivotSortFn
Title: Re: how to sort the pivot columns
Post by: 徐雪峰 on July 27, 2020, 04:32:08 pm
I still don't understand the api's paramater. i think i don't know how to use it.
I change the collumn name to let the '日合計' displayed at the last column.