ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: 徐雪峰 on July 20, 2020, 11:25:52 pm
-
how to add columns in pivotCM?
-
pivotCM is an event which is used to add, modify or delete columns in colModel of pivot grid.
These 2 examples demonstrate with code how to customize colModel in pivotCM event:
https://paramquery.com/pro/demos/pivot_custom
https://paramquery.com/pro/demos/pivot_total
Also read and understand the Columns() API which is used in above examples:
https://paramquery.com/pro/api#method-Columns
-
i have some special request. i want to add some column after pivod summary column,
for example ;
goods1 goods2 goods3 total(goods1+goods2+goods3)
2019 2020 2019 2020 2019 2020 2019 2020
but i can't do that by pivot grid
data:goods1,2019
goods1,2020
goods2,2019
goods2,2020
goods3,2019
goods3,2020
-
Please share your attempt so far via jsfiddle or stackblitz.
-
I've added this new example on add new column in pivot view for you.
https://paramquery.com/pro/demos/pivot_add_col
-
thank you for your help very much.
if i can get the group data after pivot group ,and plus or minus them,
i think all my project request will be satisfied.
about the sample code,i have a question:
1, is one() a api function? 2,can the new row have a summay?
this.one('groupData', function () {
this.pageData().forEach(function (rd, indx) {
rd.new_col = indx;
})
});
-
1. yes though one('groupData') not required if summary is to be used in the column.
2. yes, please see the updated example.