Jump to content

Hide section in list report


Recommended Posts

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.

Link to comment
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

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

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