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

Dynamically limit the number of columns in the report grid.

Kumar asked on September 20, 2019

Hi Team,
I want to dynamically limit the number of columns rendered on the report grid based on the number of columns selected(from the ‘Fields’ option in the toolbar) to be shown in the report. I don’t want the user to see the empty columns in the reports grid.
For my case, if I select 3 columns from the Fields option, I do get to see the empty columns in the grid-apart from the selected 3 columns. I don’t want to see these empty columns and want the grid size to be (rx3)[r-> number of rows; 3-> the number of columns].
It would be a great help if you could help me in achieving this use-case.
Many Thanks.

2 answers

Vera Didenko Vera Didenko Flexmonster September 20, 2019

Thank you for writing to us.
Our team kindly suggests the following approach:

1) The empty grid cells can be hidden by applying the following CSS:

#fm-pivot-view .fm-grid-layout .fm-empty {
border-color: transparent !important;

#fm-pivot-view .fm-grid-layout #fm-data-sheet {
border-top-color: transparent !important;

2) We would like to explain that at the moment the number of header cells cannot be reduced like for the empty cells.
As a workaround, please consider hiding the header cells by specifying the showHeaders property in the options object

options: {
grid: {
showHeaders: false

We have prepared a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/2dwpgqxk/.
Please let us know if you have any questions.
Best Regards,

Kumar September 20, 2019

Many thanks for writing back…
Your response solves my problem statement and does give me a better perspective on improving the grid layouts indeed!!

Please login or Register to Submit Answer