Jump to content
wgalliance

Conditionally hide column in tabular report

Recommended Posts

I would like to hide a column in a tabular report IF it meets a specific criteria. I have looked at several forum posts including the following: http://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-dynamically-change-the-background-of-a-results-page/?_ga=1.209653078.530491687.1457713192 and

 Currently I have the following script added to the footer:

<script>
var isi = document.getElementById("visi[@field:CFC_zones_OPM_Name]");
if('[@authfield:User_Table_WGAusers_Access_Level]' == 'Finance'){
isi.style.display = 'none';
}
</script>

Help would be appreciated.

Share this post


Link to post
Share on other sites

To hide particular columns (and column header) in tabular report page, add the following codes to the header and the footer

This goes in header:
<style>
#target table:nth-of-type(2) td:nth-of-type(3)  {display: none;}
#target table:nth-of-type(2) th:nth-of-type(3)  {display: none;}

#target table:nth-of-type(2) td:nth-of-type(4)  {display: none;}
#target table:nth-of-type(2) th:nth-of-type(4)  {display: none;}

#target table:nth-of-type(2) td:nth-of-type(5)  {display: none;}
#target table:nth-of-type(2) th:nth-of-type(5)  {display: none;}
</style>

<div id="target">

Add this to the footer:
</div>

The above style will hide columns 3,4 & 5. The number in table:nth-of-type(2)  depends on your result page design. If your result table is the first on the result page (case when you don't have download, or sort by dropdown or has a search form), this number should be 1. If you have download or sort by, or pre-defined criteria this number should be 2.

Number in td:nth-of-type(3) shows which column you want to hide. 1 refers to the first column, 2 second column and so on..

 

You might be able to change this solution and make it conditional ?!?!?!

 

Share this post


Link to post
Share on other sites

In case anyone comes across this post, I did finally find an answer to my question.

 

If I deploy the style to hide the column in the header of the WEBPAGE (vs header of the caspio page) then I can conditionally hide columns.

Based on what page I am on, I hide different columns. Works perfect!

Share this post


Link to post
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.

Guest
Reply to this topic...

×   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.

Loading...

×
×
  • Create New...