COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: AussiePete2011 on 11 Dec 2012 11:41:48 PM

Title: Javascript refresh issues
Post by: AussiePete2011 on 11 Dec 2012 11:41:48 PM
Hi all,
Haven't been here for a bit.. Been a bit busy
Now I have a bit of an issue using Javascript and need advice
I've attached the js file where an explanation of it can be found at http://www.kryogenix.org/code/browser/aqlists/
Basically what this does
* is to run the js file which compresses a tree prompt
* you select the second page (displays nothing)
* you then select first page which should show the compressed tree prompt but doesn't.  The tree prompt decompresses and looses format.

How can I get the javascript to re-run or refresh?

In a report you call the js file using a HTML object
<script  language="JavaScript" type="text/javascript" src="../mktree.js"></script>

Add another html object and add
<ul class = "mktree">
<li > <input id = Overall name = Overall value = 0 type = "checkbox">Overall </li >
<ul> <li > <input id = "Sales and Service" name = "Sales and Service" value = 3 type = "checkbox">Sales and Service </li >
</ul>
</ul>

You'll likely have to wrap these in <html></html> tags

Report construction
In a report Page created a radio button prompt with two options
Page1
Page2
Assign a prompt variable name like p_page

Create a conditional string variable for p_page using Page1 and Page2 as the variable options

Add a html item and copy in the call to load the js file.
E.g. <script  language="JavaScript" type="text/javascript" src="../mktree.js"></script>

Drop a conditional block onto the page
Select Page1
Add the html item with the <ul> details as above
<ul class = "mktree">
<li > <input id = Overall name = Overall value = 0 type = "checkbox">Overall </li >
<ul> <li > <input id = "Sales and Service" name = "Sales and Service" value = 3 type = "checkbox">Sales and Service </li >
</ul>
</ul>

The Page2 option should not have the html object with the <ul> tags.  It should be left blank or you could add <p>Hello World</p>  if you wanted to.

Run the report
Hopefully you will see the compressed tree prompt
Select Page2
Depending on what you did you will either see nothing at all or you'll see Hello World
Select Page1
This is where the problem occurs.
The tree prompt is decompressed and the formatting is lost.

Cheers
AussiePete