Jump to content
  • 0

Hiding columns including aggregation rows in Datapage


ray985
 Share

Question

Posted in the wrong section.

I have a datapage where I'm hiding some columns of calculated fields using CSS below. 

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

That works great, but it doesn't hide the columns in the aggregation rows so I have an overhang of dark grey in my table (see picture). Capture.JPG.27941dc587b69afbd95f1b5ccaa1b725.JPG

 

I think the problem is that in the totals rows, text spans multiple columns, so it's not really column 10 and 11 I have to hide in these rows. Does anyone know how to target these cells and hide them? 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

If I understand correctly you need to hide the full column, you can try this code:

<script language="javascript" type="text/javascript">
var stl='none';
var tbl = document.querySelectorAll('table[id^="cbTable"]')[0]; 
var rows = tbl.getElementsByTagName('tr');
for (var row=1; row<rows.length;row++)
{
var cels = rows[row].getElementsByTagName('td');
cels[1].style.display=stl;
}

rows = tbl.getElementsByTagName('tr');
for (var row=0; row<rows.length;row++)
{
var cels = rows[row].getElementsByTagName('th');
cels[1].style.display=stl;
}
</script>

 

Please note that the index for column starts at zero(0). So, if you will applying this code you need to set the cels[] number properly of the column that you want to hide. Example: You have 3 columns and you want to hide the last column, the cels[] must be set like this:      cels[2]

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.

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

Loading...
 Share

×
×
  • Create New...