If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

HowTo: Expand Collapse Report using Javascript

Started by sanchoniathon, 18 Dec 2007 03:27:02 PM

Previous topic - Next topic

sanchoniathon

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 !

kattaviz

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
thanks & regards
Satish Katta

sanchoniathon

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 !


pricter

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?

mmmalik

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