Master

Hide section in list report

6 posts in this topic

Add a header to your page and use the code below:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

Add HTML Block above all the elements that needs be hidden, uncheck HTML Editor in advanced tab and use the code below to create buttons and start the block that needs to be hidden

<input type="button" href="#" id="s[@field:ID]" Value="Show" />
<div id="b[@field:ID]">
<input type="button" href="#" id="h[@field:ID]" Value="Hide" />

At the end of the elements add another HTML Block, uncheck HTML Editor and paste this code

</div>
<script>
$(document).ready(function(){

$('#b[@field:ID]').hide();
$('#h[@field:ID]').click(
function (){$('#b[@field:ID]').hide();$('#s[@field:ID]').show();});

$('#s[@field:ID]').click(
function (){$('#b[@field:ID]').show(); 
$('#s[@field:ID]').hide();});

});
</script>

 

Note [@ID] in this code needs to be replaced with the unique ID you have in your table source.

Share this post


Link to post
Share on other sites

If you want to hide a field if the value is not equal to Gid then you need to

Add a header to your page and use the code below:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

add the code below above the conditional field in a HTML Block:

<div id="b[@field:ID]">

And this code below in HTML Block:

</div>
<script>
$(document).ready(function(){

if ("[@field:Day_Type]"  != "Gig"){

$('#b[@field:ID]').hide();
}});

</script>

Make sure you have unchecked HTML Editor in advanced tab for header and HTML Blocks

Share this post


Link to post
Share on other sites

Also...how do you get this script to work for multiple sections?  What I'm looking to do is have different sections that display the fields in those sections when the user clicks on the name of the section.  The code provided works for one section, but when I try to use it for multiple sections on a list datapage, it only works for the first section...all others fail to open/close.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now