🍉 Meet Flexmonster Pivot Table & Charts 2.9.Check out all hot features!
Get Free Trial

JSON Table Flat View shows undefined

Patrick asked on May 25, 2019

Hello Flexmonster team!
My company is currently evaluating your product, but we are getting funny results. For a JSON data type Flat View, when a cell in a row isn’t defined, it puts ‘undefined‘ in the cell
The preferred behavior for us is to show a blank cell when that json field was omitted from that row of results. Is there any way to override this?

Please note, we’ve tried putting in blank values in the JSON file, but that takes up an enormous amount of extra space when we have sparse data…plus it comes with its own issues (blank string cells say ‘(blank)’ which is hardly better).

We’d love to be able to change a config which sets all undefined/blank labeled cells be empty when the JSON doesn’t have a column key defined for a given row.


2 answers

Vera Didenko Vera Didenko Flexmonster May 27, 2019

Hello, Patrick,
Thank you for writing to us.
Our developer team has looked into your request and decided to change how omitted values are shown by default in Flexmonster: instead of “undefined” such data will be displayed as “(blank)”.
We would like to point out that showing “(blank)” instead of “undefined” for both cases (when a JSON field was omitted and when blank values are present) would be more convenient because all cells containing “(blank)” can be easily customized via localization.
This update will be available in the minor release of Flexmonster with the ETA 1st of July.
As a temporary solution, we kindly advise using the customizeCell approach to achieve the desired output:

customizeCell: customizeCellFunction

and defining the function for customizing the cells, for example:

function customizeCellFunction(cell, data) { 
if(data.label === "undefined"){
cell.text = "";

Here is a JSFiddle example for illustration.
Please let us know if this works for you and if you have further questions.
Best Regards,

Vera Didenko Vera Didenko Flexmonster July 2, 2019

Hello, Patrick,
We are glad to inform you that the issue with showing undefined instead of (blank) was fixed.
Now cells containing (blank) can be easily customized via localization:

global: {
localization: {
grid: {
blankMember: ""

Here is a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/jz1tdrex/
This is available in the 2.7.9 version of Flexmonster: https://www.flexmonster.com/release-notes/
You are welcome to update the component: https://www.flexmonster.com/doc/updating-to-the-latest-version/ 
Please let us know if everything works fine for you.
Best Regards,

Please login or Register to Submit Answer