test

Warning when upgrading to Spotfire 10

TIBCO has deprecated the JQueryUI Javascript library in the latest Spotfire 10.0 release

TIBCO Community pages show us how to use JQuery properly

Change "(none)" from Drop-down list property control to something else

HTML
<DIV id="ddowns">
Dropdown 1: <SpotfireControl id="y0urdr0pd0wnpr0p3rtyc0n7r01"" /><br/>
Dropdown 2: <SpotfireControl id="y0urdr0pd0wnpr0p3rtyc0n7r02"" />
</DIV>

JS (6.5-)
$("#ddowns select option:first-child ").text("All")

JS (7.0+)
//change (None) to ALL 
function changeSelection(){ $("#ddowns .sf-element-text-box").each(function(i,e){ if (e.innerHTML=="(None)") e.innerHTML="-ALL-" }) }

//change (None) when dropdown is visible
$("#ddowns").on('click',function(){
a=document.querySelector("#ddowns .ListItems:first-child").firstChild
a.innerText="(ALL)"
setTimeout(changeSelection,50) //if does not work, increase this value
})

//change (None) first time
changeSelection()




14 comments:

Stuart McBain said...

Hi,

I'm new to spotfire and scripting and can't get this to work. Can you be specific as to where to add the JS.

I have added to add it via the HTML editor (via the add JS button) but it does not work for me.

I has also tried script tags but that does not work either

Jose Leviaguirre said...

Hello Stuart.

Script tags and other tags inside html might not work because of a 'perform html sanitation" setting. Your spotfire admin should know about this. In any case, this script should work with or without html sanitation. Just put the html in the html text area and add the Javascript code by using the JS button.

Jose.-

Ram said...

Hi Jose,

I am not able to change 'none' in list box property control to 'All' using above script. is it possible only in drop down property?

Jose Leviaguirre said...

Ram, it only works for dropdowns

Bhoobalan R said...

Its not working for 7.5 & above versions

Jose Leviaguirre said...

See code for 7.0+ hope it works! The entire architecture on 7+ is totally different

Bhoobalan R said...

Thanks a Lot Jose !!!!! This absolutely works now :) :)

Arthur said...
This comment has been removed by the author.
kartik joshi said...

Hi
Thanks Jose

It's working for Single dropdown
any workaround for Multiple dropdown?

Jose Leviaguirre said...

Hello Kartik,

I have updated the script. It should work for multiple dropwdowns now. Thanks for your letting us know.

kartik joshi said...

Thanks a lot Jose

This absolutely working now :) :)

Khadar Vali said...

Thanks for your post Jose,

i have used the same script for drop down."All" value is showing at the time of first time only,but if i select drop down it's automatically changing to "(None)".

can you please help to resolve the issue.

Jose Leviaguirre said...

try increasing the timeout value. Use 500 (1/2 second)

Kevin Choi said...

Hmm I seem to have the same issue as Vali. What exactly does increasing the time to 500 do?