Get Free Trial

When no data/columns is provided, hide 'Fields' modal

Patrick Berens asked on February 26, 2020

Hiya Flex Team,
We are using Flat View to display some data and we have the toolbar hidden. However, sometimes our JSON response comes back like the following:


In this case, the ‘Fields’ selector pops up. Is there a way to disable this permanently for a Flexmonster instantiation? We use it on other pages, but for this page we just use the Flat View to display data and we’d like it to show as empty (“spreadsheet” look).
I’ve attached a picture of the bad state we’d like to avoid.


3 answers

Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 27, 2020

Hello, Patrick,
Thank you for reaching out to us.
The described behavior can be achieved using two approaches.
The Field List will not be opened in case the dataSource object is missed or does not contain data or filename property. In such a situation, an empty grid will be shown.
However, as we can see from your question, the JSON response is not always empty, and the filename property is required. In this case, our team suggests embedding of following code snippet to the page:

pivot.on('reportcomplete', function() {"reportcomplete");
    if (pivot.getAllHierarchies().length == 0)
        pivot.setReport(pivot.getReport().dataSource = {});

The block of code provided above is executed when the reportcomplete event is triggered. It scans all hierarchies presented in the data set and modifies the dataSource object in case the data set does not contain any hierarchies, thereby the Field List is not opened, and the empty spreadsheet is displayed.
Please refer to an example we have prepared for you.
More information about API calls and object used in the example:

We hope it works for you.
Please contact us in case any additional questions occur.
Best regards,

Patrick Berens March 2, 2020

Thanks, we hacked around on BE and wiped the header when no data is returned.
THanks again,

Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 3, 2020

Hello, Patric,
Thank you for your feedback.
We are happy to hear you have managed to achieve the desired result.
Do not hesitate to contact us in case other questions arise.
Kind regards,

Please login or Register to Submit Answer