Have tried multiple formats to remove .0 decimal in column cant see to remove.
Below is formatting
const format = {
name: 'removeDecimal',
decimalPlaces: 0,
};
this.citationPivot.flexmonster.setFormat(format);
Hello,
Thank you for contacting us.
Kindly note that if you want to set the default format for all the fields, the name
property of the format
object should be set to ""
:
const format = {
name: "",
decimalPlaces: 0,
}
Also, you should use the refresh() API call after setting a format to see changes. Please check the following example for reference: https://jsfiddle.net/flexmonster/Lft15349/.
Please let us know if it works for you. Looking forward to hearing from you.
Kind regards,
Nadia
1. your fiddle example is also broken on Export to Excel. it has .0 decimal.
Please let me know how to fix as soon as you can.
My code with refresh
exportExcel(whichTab) {
let currentTitleExcel =
'<center><h1>' + this.customLabel + '</h1></center>';
const format = {
name: '',
decimalPlaces: 0,
};
switch (whichTab) {
case 'TAB1':
{
this.testPivot.flexmonster.setFormat(format);
this.testPivot.flexmonster.refresh();
this.testPivot.flexmonster.exportTo('excel', {
header: testTitleExcel.toString(),
});
}
break;
case 'TAB2':
{
this.test2Pivot.flexmonster.setFormat(format);
this.test2Pivot.flexmonster.refresh();
this.test2Pivot.flexmonster.exportTo('excel', {
header: currentTitleExcel.toString(),
});
}
break;
default:
{
//do nothing
}
break;
}
}
Hello Lance,
Thank you for the response.
We could not reproduce the described behavior on our side. Please see the following example: https://jsfiddle.net/flexmonster/n0ao4jd3/. When you click the "Set format and export" button, the grid is exported without decimal places.
Alternatively, you can set the format directly in the report object. For example:
report: {
// other configs
formats: [
{
name: "",
decimalPlaces: 0
}
],
}
This way, the format will be applied to all the measures. You are welcome to use the following JSFiddle for reference: https://jsfiddle.net/flexmonster/1v62rf3q/.
Please let us know if it works for you. Looking forward to hearing your feedback.
Kind regards,
Nadia
Seems I need to code for Default Value since not set initially
Though I put code as stated