Hi all
I'm having similar problem as in this thread: http://www.cognoise.com/index.php/topic,26076.0.html
I want to fix the size of the search and select lists so they don't grow when text is longer then the width od the box (select item). With above js i managed to resize one box (right one - select), but it still does not work for result SELECT item. It always stays on 200px width and when search results are long (a long text) Cognos resizes it to really huge box.
So i want to fix it to 200px using JS, but don't know how.
Any ideas? Report studio 10.1.1.
Thanx
What if you change both the occurences of {selectObject[0].style.width = 'Auto';} from your code to {selectObject[0].style.width = '250';} ?
Yes i tried that. It works for second select object (selectObject[1]) which is the right one where you put wanted filters.
But it does not work for frist one (left one where your search results are displayed).
I'm guessing it overrides my javascript at some point later in page loading.
Oops! I didn't mean both the SelectObject[0], but both selectObject[0] and selectObject[1]. This works for me:
<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 = '250';}
if (selectObject[1] && selectObject[1] != undefined)
{selectObject[1].style.width = '250';}
}
}
</script>
Have you tried this?
Yes. :(
There is a fraction of a second during the page loading where i see it set as i told him but something then reset the sizes to default.
Could be due to Cognos version (10.1.1)?
I'm using RS 10.1.1. too, but it does work for me. Is it the only Javascript you have on the page?
I modified Paul's code a bit, this works for me as well:
html 1 (before the prompt):
<div id="MyPrompt">
html 2 (after the prompt):
</div>
<script>
var e=document.getElementById('MyPrompt');
var block1 = e.getElementsByTagName('select')[0];
block1.style.width='250';
var block2 = e.getElementsByTagName('select')[1];
block2.style.width='250';
</script>
Nope. Something still resets it by the end of the page load.
I managed to do it with delayed start so i change the size after all other processing is done.
Something like this:
<script type="text/javascript">
setTimeout(function(){
var e=document.getElementById('MyPrompt');
var block1 = e.getElementsByTagName('select')[0];
block1.style.width='250';
var block2 = e.getElementsByTagName('select')[1];
block2.style.width='250';
},100);
</script>