Jump to content
  • 0

Display Specific Columns



2 answers to this question

Recommended Posts

  • 0

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:
 #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;}
 <div id="target">

And this in the Footer:

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.

Link to comment
Share on other sites

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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...