Need a special offer?Find out if your project fits.
+

setFormat() issues

Answered
Javier G. asked on August 7, 2019

Hello,
I'm using Flexmonster v2.7.1. and I'm having some troubles using the setFormat() API call.
After calling the flexmonster.refresh() function, the grid is not updated with the formatting options introduced. I'm using this code in Javascript:
format = {
"maxDecimalPlaces ": "2",
"nullValue" : "0"
};
flexmonster.setFormat(format);
flexmonster.refresh();
As said, the report is not being refreshed (null values in the grid are still showing empty cells). However, if I then open up the format cells modal window, the 2 decimal places and 0 as null value are actually configured and shown there (and then if I just hit the apply button, the format is correctly applied on the grid cells).
Am I doing something wrong? 
Thanks in advance.

2 answers

Public
Ian Sadovy Ian Sadovy Flexmonster August 7, 2019

Hello Javier,
 
Thank you for the question.
Please note, that default formatting also requires a name: "" in the format object.

var format = {
name: "",
maxDecimalPlaces: 2,
nullValue: "0"
};
flexmonster.setFormat(format);
flexmonster.refresh();

Please refer to the following sample: https://jsfiddle.net/flexmonster/3y9odjhq/
 
Let us know if it works for you.
 
Regards,
Ian

Public
Javier G. August 8, 2019

Hello Ian,
Yes, adding the name:"" field worked perfectly.
Thank you!

Please login or Register to Submit Answer