Get Free Trial

How to update behavior when new formatting settings are set for all values?

Denis asked on June 14, 2020


We are trying to adapt the behavior of changing the formatting of all values to our requirements.
As far as I understand, changing the formatting of all values doesn’t change the formatting of absolutely all metrics, but only those who do not currently have their own formatting, i.e. this does not affect those metrics that already have their own formatting.

For example, we have 3 formats before applying new all format values: report.formats = [{name: ” “, …}, {name: “1format”, …}, {name: “2format”, …}, {name: “3format”, …}], after applying we want to have only all value format: [{name: ” “, …}], and this format should apply for all metrics.

So, we are overriding customToolbar.js to reach new approach. Now tried to apply something similar to this: 

currentReport.formats = currentReport.formats.filter(format => === '')

However, this updates the entire report along with the data and causes the spinner to load after applying the format, looks like an overkill.
Perhaps there are some other options to remove all formats from report.formats? And besides this, we need to remove the formats from slice.measures.

Thanks in advance,

2 answers

Illia Yatsyshyn Illia Yatsyshyn Flexmonster June 15, 2020

Thank you for reaching out to us.
Our recommendation is to clear formatting for all displayed measures before applying another one.
It is achievable using the following construction:

for (let measure of flexmonster.getMeasures()) {
flexmonster.setFormat({}, measure.uniqueName)
name: "",
//new formatting rules

The getMeasure API call allows retrieving all displayed measures. Next, an empty Format Object is specified as the first parameter of the setFormat method. Such operation is performed for each measure from the grid.
Finally, the desired formatting for all measures can be specified.
You are welcome to check out an example demonstrating the described approach.
Please let us know if it helps.
We are looking forward to hearing from you.

Denis June 16, 2020

Yeapp, it works fine, thanks

Please login or Register to Submit Answer