Change the Size of a List Collector Slushbucket Variable

alhicks
Tera Guru

I've tried the Catalog Client Script from the svc now guru website and it doesn't seem to work for me. All I changed was my variable name in the script below and the size of the list collector did not change any. Any ideas what would cause this Catalog Client Script NOT to work for me.

http://www.servicenowguru.com/scripting/client-scripts-scripting/change-size-list-collector-slushbuc...

function onLoad(){
var varName = 'YOUR_VARIABLE_NAME_HERE';
var height = '10'; //Optional
var width = '250'; //Optional
//Get the left and right bucket input elements
var leftBucket = gel(varName + '_select_0');
var rightBucket = gel(varName + '_select_1');
if(height && g_form.getControl(varName)){
//Adjust the bucket length (default is 18)
leftBucket.size = height;
rightBucket.size = height;
}
if(width && g_form.getControl(varName)){
//Adjust the bucket width (default is 340)
leftBucket.style.width = width;
rightBucket.style.width = width;
}
}

27 REPLIES 27

I compared and didn't see any differences. Item is "Data Center Temporary Access" on our Production instance https://shaw.service-now.com/navpage.do. I look tomorrow for other client scripts and ui policies. Any help would be greatly appreciated. 🙂


Mark,


I pasted your script (as below) and it doesn't seem to be doing anything.   Can you help me troubleshoot?


Thank you,


Donna Lively



function onLoad(){


      var varName = 'campus';


      var height = '10'; //Optional


      var width = '250'; //Optional


      try{


              //Get the left and right bucket input elements


              var leftBucket = $(varName + '_select_0');


              var rightBucket = $(varName + '_select_1');


             


              //If the element exists


              if(leftBucket){


                      //Adjust the bucket height (default is 300px)


                      if(height){


                              leftBucket.style.height = height + 'px';


                              rightBucket.style.height = height + 'px';


                      }


                     


                      if(width){


                              //Adjust the bucket width (default is 340px)


                              leftBucket.style.width = width + 'px';


                              rightBucket.style.width = width + 'px';


                                                              //Fix Fuji/Geneva width issue


                                                              leftBucket.up('.slushbucket').style.width = width*2 + 100 + 'px';


                      }


                     


                      //Fix the expanding item preview issue


                      $(varName + 'recordpreview').up('td').setAttribute('colSpan', '3');


              }


      }catch(e){}


}


drewc
Mega Contributor

this control over the slushbucket size is working great on first load... but if the text inside is long enough our slushbuckets are automatically expanding. At 1024x768 (a resolution a great number of our users are locked into), this causes rendering issues in IE8 (a browser a great number of our users are also locked into).

anyone know how to get the slushbucket to NOT auto-size?


Is it the sides of the slushbucket that are auto-sizing or is it the text below the slushbucket that is changing size? The script I wrote adjusts the size of each side of the slushbucket. I suspect what is auto-sizing is the text that appears directly below the slushbucket when you select an item. That happens regardless of whether or not you use my script and it happens because those contents are part of the same underlying table structure. If you can confirm exactly what you're seeing I can see if I can find a way around it.

It looks like the 'td' element that houses the record preview items has a 'colspan' attribute value of 2. It should be set to 3. I would report this to ServiceNow as a bug but I can probably provide a workaround in this script.


drewc
Mega Contributor

hi mark -
the buckets themselves are changing size. One of the records that one of our slushbucket onload filters returns is named

DATA2 VIN Title Laser Sheets - 2.625"× 1.0" blank removable paper labels - 1,250 sheets per case

which I know is long... but chrome and firefox handle it fine (even with the bucket auto-sizing).
IE8 pushes the cart off screen.