0
votes

I have a button inside an xpages div and I am trying to compute the style class of that button based on a scoped variable.

Initially, the scoped variable's value is 'blue' and the background color of the button inside the div is blue as well.

When I click on a second button, I set the value of the scoped variable to 'green' and do a partial refresh of the div.

Now, I would expect the button to turn green, but the class is not being changed.

Here is the SSJS for computing the style class:

if(sessionScope.sTest == 'green'){
    return 'btn-success';
}
else{
    return 'btn-primary';
}

So, my question is, is a style class recalculated during a partial refresh or would I have to resort to either JQuery or Dojo in order to change the style class.

Any help would be highly appreciated!

2
An easier solution would be to use jQuery and to use the addClass() and removeClass() functions.9997
post the code that uses the return stringRooster

2 Answers

3
votes

if you disable the theme for the button it should work

<xp:button id="btn" disableTheme="true"></xp:button>    
0
votes

Please don't compare Java Strings like that, use .equals("...") instead.