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

When there is only one field [Measure] in columns or rows, runQuery works strangely.

Courtney Chow asked on January 3, 2020

The issue is, when there is only [Measure] left in the field list, we expect runQuery to create an empty table. Although we are creating our own version of field list, the official demo works like this (you have to set field list position to “right” in order to unselect all fields except for [Measure]).
But in fact the runQuery displays a table with some default columns, rows and measures. I tried to use flexmonster.clear(), but after that any runQuery call would cause an error. Right now we have to add some logic to prevent the situation when there is only [Measure] in the field list, which is not optimal.
How to let runQuery displays an empty page?

1 answer

Mykhailo Halaida Mykhailo Halaida Flexmonster January 6, 2020

Hi Courtney,
Thank you for reaching out.
In your case, we would suggest using the showDefaultSlice property of the options object, which defines whether the component selects a default slice for a report with an empty slice (when nothing is set in rows, columns, report filters, and measures). It is set to true by default, in which case the first hierarchy from the input data goes to rows and the first measure goes to columns in the default slice. If false, the grid remains empty until any part of the slice is set, resulting in the desired behavior.
We’ve prepared a small JSFiddle example in order to illustrate this functionality: https://jsfiddle.net/flexmonster/kh06cfsq/
Please let us know if this helps.
Best regards,

Please login or Register to Submit Answer