function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Luke@TWSLuke@TWS 

Acess properties of selectOption

Code:
List<SelectOption> options = new List<SelectOption>();
SelectOption option = new SelectOption('code','description');
option.style.fontWeight = 'bold';
options.add(option);

 Trying to implement something similar to the above code but it throws the error:

Compile Error: Expression of type System.SelectOption has no member named style

and also does the same for the other properties. How do you set the properties like style?
jwetzlerjwetzler
can't you just use the style attribute in your apex:selectList component (or whichever select component you're using)?

You can't access tag attributes like that in Apex code.
Luke@TWSLuke@TWS
I'd like some to be bold and some to be normal weight so the style must be applied at the option level. I intend to add some more javascript functionallity to it that is also not possible to do in apex. The weighting could also be done in javascript but it would be much neater if I could do that in apex/visualforce
kyleRochekyleRoche
bind the style="{!var.stylevalue}"... you probably have to restructure your markup... but, that's how i'm using it.
Luke@TWSLuke@TWS
great I'll give that a go, cheers kyle