Author Topic: Cognos 10.2.1 Search & Select prompt width (SOLVED)  (Read 15168 times)

Offline hanfrie

  • Full Member
  • ***
  • Join Date: Jul 2014
  • Posts: 24
  • Forum Citizenship: +2/-0
Cognos 10.2.1 Search & Select prompt width (SOLVED)
« on: 02 Oct 2014 09:19:19 am »
Hello all,

I'm having trouble finding a solution for the well known issue regarding the width of the search & select prompt. I'm aware of the solution provided by IBM which involves changing the parameter SYSTEMPROPERTY_CSEARCH_AUTO_RESIZE_RESULT_LIST to TRUE. Unfortunately I am not allowed to change this setting. So it has to be done within the report itself. I've tried the solution provided by Cognospaul.com ( http://cognospaul.com/2012/01/10/quickie-dynamic-select-and-search-size/ ), which does the trick, but if you use the multi-select option, as I need too, it only adjusts the left table, which holds all the found matches, but not the right table that holds the selected ones.
The solution mentioned in http://www.cognoise.com/index.php?topic=6519.0 does not work, probably because I use Cognos 10.2.1? I have no knowledge of java but luckily am able to copy/paste, so any suggestion would be highly appreciated.
« Last Edit: 07 Oct 2014 03:01:45 am by hanfrie »

Offline hanfrie

  • Full Member
  • ***
  • Join Date: Jul 2014
  • Posts: 24
  • Forum Citizenship: +2/-0
Re: Cognos 10.2.1 Search & Select prompt width
« Reply #1 on: 06 Oct 2014 05:31:31 am »
anyone?

Offline hanfrie

  • Full Member
  • ***
  • Join Date: Jul 2014
  • Posts: 24
  • Forum Citizenship: +2/-0
Re: Cognos 10.2.1 Search & Select prompt width
« Reply #2 on: 07 Oct 2014 02:59:48 am »
I'm happy to inform you all that IBM provided me the solution:
Put three HTML Items around the Search & Select prompt, two on the left, one on the right. I call them html1, html2 and html3. Put the following text into html1, html2 and html3 respectively;

html1:

<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>

html2:

<div id="myPrompt">

html3:

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

Now both Search & Select boxes are automatically resized.

hanfrie

Offline jackmaster

  • Full Member
  • ***
  • Join Date: Apr 2012
  • Posts: 7
  • Forum Citizenship: +0/-0
Re: Cognos 10.2.1 Search & Select prompt width (SOLVED)
« Reply #3 on: 12 Dec 2014 07:03:09 am »
This solution works perfectly for me and i'm on 10.2.1. In my case, i want to fix the size of the search input textbox also, i all need to do is to add:

var inputObject =  eleTg1.getElementsByTagName('INPUT');

then apply the same rule like the selectObject.

Again, thank you very much for the solution!

Cheers,

Offline challapureddy2000@yahoo.c

  • Associate
  • **
  • Join Date: Jan 2016
  • Posts: 1
  • Forum Citizenship: +0/-0
Re: Cognos 10.2.1 Search & Select prompt width (SOLVED)
« Reply #4 on: 20 Jan 2016 11:33:00 am »
this works great!!

Offline smiles0210

  • Associate
  • **
  • Join Date: Jul 2016
  • Posts: 1
  • Forum Citizenship: +0/-0
Re: Cognos 10.2.1 Search & Select prompt width (SOLVED)
« Reply #5 on: 12 Jul 2016 01:40:56 pm »
This works perfectly! But...What if I have 2 search and selects on the same prompt page?

Offline colac

  • Associate
  • **
  • Join Date: Nov 2016
  • Posts: 1
  • Forum Citizenship: +0/-0
Re: Cognos 10.2.1 Search & Select prompt width (SOLVED)
« Reply #6 on: 15 Nov 2016 02:02:12 pm »
I found the dynamic size adjustment to produce an inconsistent results across browsers. So I opted for a fix width. IMO fix width is a better solution overall. I think the consistent interface has a better design appeal for one. And two, adopting the fix width design philosophy, maintenance will be much less of an issue or concern for the Select & Search Prompt due to changes over time with new Cognos Versions or Client Browser changes. IMO, if the text is too long in the select, I would consider alternate ways of displaying the text. Ellipses maybe, or honestly just let the overflow be hidden. People can figure out what it says. The select's can only be so big before the resolution or browser window size becomes an issue for the user anyway. Delivering a consistent experience is really important to web development imo, and unfortunately an eloquent classic solution for dynamic size selects is not achievable with current factors considered.

This is my solution for IBM Cognos Version 10.2.2



Reference: < HTML Item > (Upper Left)
Description: This code begins the html to wrap the Select & Search Prompt in a html div element
Code: [Select]
<div id="myPrompt">

Reference: < HTML Item > (Upper Right)
Description: This code begins the html to wrap the Select & Search Prompt in a html div element
Code: [Select]
</div>


Reference: < HTML Item > (Bottom Left 1)
Description: This code sets the first two html select elements in the div wrapper to width 300px using javascript and dom api
Code: [Select]
<script language="javascript">
(function () {
"use strict"; 
var eleTg1 = document.getElementById("myPrompt");
    var selectObject = null;

    if (eleTg1 && eleTg1 !== undefined) {
        selectObject = eleTg1.getElementsByTagName("SELECT");

        if (selectObject[0] && selectObject[0] !== undefined) {
selectObject[0].style.width = "300px";
        }

        if (selectObject[1] && selectObject[1] !== undefined) {
selectObject[1].style.width = "300px";
        }
    }
}());
</script>

Reference: < HTML Item > (Bottom Left 2)
Description: This code makes "Contains any of these keywords" be the default option for the Select & Search Prompt in the div wrapper. It's configurable if you prefer a different setting. I now it's not related to this post topic, but it's helpful so I include it if it helps anyone.
Code: [Select]
<script language="javascript">
function setSaSoptions(){
var optNo = 3; // 1 = Starts with any ... (default) / 2 = Starts with first ... / 3 = Contains any ... / 4 = Contains all ...
var optCnt = 0;
var mySpan = document.getElementById('myPrompt');
var myInput = mySpan.getElementsByTagName('input');
for(i=0;i<myInput.length;i++){
if(myInput[i].type=='text') {
if(myInput[i].value>''){
return;}}
if(myInput[i].type=='radio') optCnt++;
if(optCnt==optNo) myInput[i].click();
}
}
setTimeout(setSaSoptions(), 100);
</script>
« Last Edit: 15 Nov 2016 02:28:17 pm by colac »

 


       
Twittear