RunForrestRun Posted November 13, 2021 Report Share Posted November 13, 2021 Hi guys! I have a pivot table and and a separated search form. I want to show or hide specific columns based on a dropdown field that I have included on the search form. Do you guys have any idea how to achieve this? Quote Link to comment Share on other sites More sharing options...
0 Tubby Posted November 13, 2021 Report Share Posted November 13, 2021 I don't know if this will fit your workflow but I have this CSS code that I am using for a tabular report. I have tested this in a pivot table as well so it should work on your pivot properly: Put this code in the Header: <style> #target table:nth-of-type(1) td:not(:nth-of-type([@FieldtoDisplay])) {display: none;} #target table:nth-of-type(1) th:not(:nth-of-type([@FieldtoDisplay])) {display: none;} /* The part below is for excluding a column from being hidden by default*/ #target table:nth-of-type(1) td:nth-of-type(1) {display: table-cell;} #target table:nth-of-type(1) th:nth-of-type(1) {display: table-cell;} </style> <div id="target"> And this in the Footer: </div> Basically, what this code does is hide all the columns by default except the column specified using the NOT selector of CSS. You can specify your column by passing a parameter from your separate search form [@FieldtoDisplay]. This parameter should contain a integer value that corresponds to the position of the column that needs to be displayed. The second part of the code is optional, it can be added if you wish to diplay a certain column regardless of the selection. Let's say you have a column for ID or Name and you want them to be visible at all times, you can specify their position and change "1" to exclude them from being hidden. RunForrestRun 1 Quote Link to comment Share on other sites More sharing options...
0 RunForrestRun Posted November 13, 2021 Author Report Share Posted November 13, 2021 Thanks for the solution, @Tubby! This worked perfectly! Quote Link to comment Share on other sites More sharing options...
Question
RunForrestRun
Hi guys!
I have a pivot table and and a separated search form.
I want to show or hide specific columns based on a dropdown field that I have included on the search form.
Do you guys have any idea how to achieve this?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.