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

Tree Prompts with java script on page

Started by dannygutters, 11 Aug 2010 03:51:34 PM

Previous topic - Next topic

dannygutters

I have a prompt page with both a tree prompt and a search and select box. I added some javascript to resize the results pane of the search and select box.

But when I include this resize code it causes the other tree prompt to render blank. Any ideas on what is happening here? Is there a way to have cognos redraw the tree prompt correctly while still alowing me to modify the search box size? I don't see why it's affecting the tree since everything in the javascript is modifying an associated div.

something like:
<script>
getelementbyid(mydiv)
Find the node within mydiv object that starts with TYpe (search box)
get the element by id here (gets the search box)
set it's width to 500
</script>

rockytopmark

I am experiencing this exact problem myself.  If anyone has worked through this issue, please do share!!

Thanks... Mark

rockytopmark

Working with a post on a different forum, I was able to produce a solution.  Thanks to "Ajitha" for the starting point...

I have this working in my 8.4 environment.  As I have many prompt controls, I have altered the solution as follows so as to re-use the function for any prompt to be re-sized by adding a parameter to be passed in related to the object name (DIV):


1.   Add an HTML item to the top of the Page Body and include the following code in it:

<script language="javascript">
function resizeSS(prmt_id)
{
var eleTg1 = document.getElementById(prmt_id);
var selectObject = null;
if (eleTg1 && eleTg1 != undefined)
{selectObject = eleTg1.getElementsByTagName('SELECT');
   if (selectObject[0] && selectObject[0] != undefined)
    {selectObject[0].style.width = 'Auto';}
   if (selectObject[1] && selectObject[1] != undefined)
    {selectObject[1].style.width = 'Auto';}
}
}
</script>



2.   Before each and every Search and Select prompt control to be auto-sized, add an HTML item and insert the following code in it, changing prompt_name for each control so that it is named meaningfully and unique:

<DIV ID="prompt_name">




3.   After each Search and Select prompt control to be auto-sized, add an HTML item and insert the following code in it, changing prompt_name for each control so that it is using the name given in the DIV tag in the HTML Item before the prompt:

</div>
<script language="javascript">
resizeSS('prompt_name');
</script>




I should also note where the fixed width pixel values of 600 were replaced with 'Auto'
...this will automatically expand the width of the object based on the search results/selections.

M

MFGF

Cool!  Thanks for sharing the solution Mark! Very much appreciated!

MF.
Meep!