COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: aravind006 on 04 Feb 2016 03:08:55 AM

Title: Show or Hide any Element in cognos 10.2.2 report studio
Post by: aravind006 on 04 Feb 2016 03:08:55 AM
Hi,

Please let me the code for to Show or Hide any Element in the cognos 10.2.2, using Javascript.


Thanks ,
Aravind
Title: Re: Show or Hide any Element in cognos 10.2.2 report studio
Post by: BigChris on 04 Feb 2016 03:19:57 AM
Wouldn't you be better with render variables? Javascript is prone to getting broken with new releases etc.
Title: Re: Show or Hide any Element in cognos 10.2.2 report studio
Post by: afzaki7 on 04 Feb 2016 05:28:27 AM
Hi,

Surround the element with two HTML one before it and one after

put in the first HTML

<div id="myDIV" >

and for the other HTML

</div>


then from java-script we will set (style="display:none" ) to the div

so add another HTML in and put code like that


<script>
function hideElelment()
{
document.getElementById("myDIV").style.display = "none";
}
</script>
<button type="button" onclick="hideElelment();" > Click Me!</button>


Title: Re: Show or Hide any Element in cognos 10.2.2 report studio
Post by: bdbits on 04 Feb 2016 11:46:48 AM
While javascript will work, I'd have to agree with BigChris that you should avoid using it if there is a native, out-of-the-box way to accomplish the same thing.
Title: Re: Show or Hide any Element in cognos 10.2.2 report studio
Post by: MFGF on 05 Feb 2016 04:04:23 AM
Also bear in mind that when you move to Cognos Analytics (Cognos 11), JavaScript is not supported at all when the viewer is in interactive mode. Why would you code your way into a blind alley like this when there are suitable alternatives that will continue to work?

MF.