COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: sanchoniathon on 18 Dec 2007 03:27:02 PM

Title: HowTo: Expand Collapse Report using Javascript
Post by: sanchoniathon on 18 Dec 2007 03:27:02 PM
Hi to everyone,

Has anyone ever been able to make work an expandable list correctly as suggested in Cognos's support site ?

--------------------------------------------------------------------------------
Title: HowTo: Expand Collapse Report using Javascript
Document#: 1030839.1
Updated:  Nov 14, 2007

Applies To:  Cognos 8 BI Framework Manager 8.2 | Cognos 8 BI Report Studio 8.1 | Cognos 8 BI Report Studio 8.2
SRs: 8
Collection:  KB

Description: How do you create a list report that has a column that can expand and or collapse using Javascript?
Solution: This is as an example of what can be done with Javascript to expand the capabilities for Report Studio.

Add the following HTML items to the column with the following script in the list header
- HTML item

<img onclick='ExpandCollapse(this)' src=http://iss-webprodappint.cognos.com:80/portalad/gateway/gateway.asp?GID=1382&CID=488&URL=http%3A%2F%2Fiss%2Dwebprodappint%2Ecognos%2Ecom%3A80%2Fkb%2Ddev%2F%27%2E%2E%2Fpat%2Fimages%2FPropertyGroup%5Fplus%2Egif%27 style='cursor:hand; vertical-align:middle; margin-right:2px'/><span onclick='ExpandCollapse(this.previousSibling)' style='cursor:hand'>

Query ITEM
[gosales_goretailers].[Countries].[Country]

HTML item
</span>
--------------------------------------------------------------------------------

Thanks in  advance to anyone with valuable tips or adivces !
Title: Re: HowTo: Expand Collapse Report using Javascript
Post by: kattaviz on 14 Jan 2008 02:15:52 PM
Hi,
You can do this by simple javascript code.

if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  return true;

Replace "e" with your element name.

HTH
thanks,
Satish Katta
Title: Re: HowTo: Expand Collapse Report using Javascript
Post by: sanchoniathon on 21 Jan 2008 09:08:44 AM
Thanks Satish,

But i finally found out what was not going ok in the expandable list i was using. I forgot (as mentioned in the cognos pdf file) to add a PADDING of 20 px for the first level and 40 px for the second level on my list. All of this for the LEFT padding.

After applying these padding to my list the code was acting as expected.

Good day to all !
Title: Re: HowTo: Expand Collapse Report using Javascript
Post by: nugget on 17 Feb 2009 05:55:55 AM
http://www.itap.purdue.edu/ea/files/CreatingAReportIndexUsingHTMLItems.pdf (http://www.itap.purdue.edu/ea/files/CreatingAReportIndexUsingHTMLItems.pdf)
Title: Re: HowTo: Expand Collapse Report using Javascript
Post by: pricter on 19 Jun 2009 04:31:14 AM
Regarding the Cognos propose about "HowTo: Expand Collapse Report using Javascript" does anyone has succeed in creating this tree structure with an unbalanced hierarchy?

Which modifications should I made to the technique?
Title: Re: HowTo: Expand Collapse Report using Javascript
Post by: mmmalik on 15 Feb 2012 11:57:23 PM
Hello everyone,

I am trying to develop a report with expandable list which can show multiple levels data at the same list but no success yet. Can anyone please guide me how to do so in Cognos 10.1?

@ sanchoniathon:
Can you share your experience plz.