Customizing showGrandTotals Option for Specific Columns

Answered
ELG PEDESTAIS asked on February 6, 2024

I'm writing to inquire whether it is possible to customize the "showGrandTotals". Specifically, we are interested in activating this option for only certain columns. We would like to define the columns to which this option will apply.
Below is an excerpt of the code for your reference:
"options": {

                "grid": {
                    "type": "flat",
                    "showTotals": "off",
                    "showGrandTotals": "on"
                },
                "chart": {
                    "type": "line",
                    "showDataLabels": true,
                    "showFilter": true,
                    "showMeasures": false,
                },
            }

We would appreciate it if you could provide guidance on how we can achieve this customization or if this functionality is supported.
Thank you in advance for your attention to this matter.

2 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 7, 2024

Hello,

Thank you for reaching out to us.

We recommend using the customizeCell API call to hide the Grand Totals for specific columns. For example:

let hiddenGrandTotal = ["Quantity", "Discount"];

flexmonster.customizeCell((cell, data) => {
  if (data.isGrandTotal && data.hierarchy && hiddenGrandTotal.includes(data.hierarchy.caption)) {
    cell.text = "";
  }
});

You can set additional conditions to hide the totals for the specific columns. Please check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/5j6fh7bc/ 

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 14, 2024

Hello,

Hope you are doing well.

We were wondering if you had a chance to check the suggested approach. Could you please confirm if it works for you?

Looking forward to hearing your feedback.

Kind regards,
Nadia

Please login or Register to Submit Answer