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

That's interesting. I'm testing on demo13 right now using a slushbucket on the 'iPhone 4' catalog item. The slushbucket size isn't changing there in IE 9, even with users that have very long names. Can you give that a quick test and see if it works there for you too?


I actually just implemented this same thing in my instances and have a similar issue. If the value in the slush bucket is selected and the character length is long it will increase the slushbucket size and expand it to the right.
My issue specifically is happening because the frame for my catalog item is quite small (max width of ~240), so I can understand why that's happening.
Having spaces in the value though seems to help because the output gets word wrapped at the spaces when being displayed under the slushbucket.
I tested it in both IE9 and Chrome and both do pretty much the same thing, except Chrome seems to format it a little nicer and not completely shift the right slushbucket out of the visible portion of the frame. (My instances)
The demo Mark put up, I tested also and it does the same thing of shifting to the right, except it doesn't go out of frame because there is more space already available for the slushbucket to expand in to.

Not sure if this helps, but if you have a similar setup as I do where your iframe is smaller in size, it could be causing the issue you're seeing.


This is good feedback, and it's what I was trying to get at in previous comments. I have yet to see anywhere that the actual size of the sides of the slushbucket increase in size based on their contents. That's what the SNGuru solution addresses and I think that's working fine. What you're seeing is that the right-hand side of the slushbucket is pushed off to the side when you select items in a slushbucket with long names. This is just due to the poor design of the slushbucket itself. You can try pasting this script just inside the closing parentheses of the SNGuru script to minimize this effect.

gel(varName + 'recordpreview').parentNode.parentNode.setAttribute('colSpan', '3');

It still won't make it go away completely for very long names but it's a lot better than the default.

Because the issue is caused by long contents in the record previews, the only real fix (aside from truncating the contents of those fields) is to modify the items that are shown in the record previews below the slushbucket as shown here.

http://www.servicenowguru.com/system-ui/customizing-slushbucket/


Thanks for the follow up on this Mark. I will try the update tomorrow and go from there.


Edit of the code above. I thought there was an issue with the 'up' prototype call, but it was an issue with 'gel'. Do NOT use 'parentNode.parentNode' from the script above. Use the script found here instead.

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