<apex:repeat value="{!myList}" var="item" id="myRepeater">
...
<apex:selectList required="" value="{!item.newValue}" id="mySelectlist" multiselect="false" size="1" style="border:none;-webkit-appearance:none;-moz-appearance:none;appearance: none;padding-right: 30px;color:rgb(31, 73, 125);">
<apex:selectOption itemValue=" " itemLabel=" " rendered="{!item.renderWhenBlank}"/>
<apex:selectOptions value="{!myGlobalSelectOptions}" />
</apex:selectList>
...
</repeat
Scenario:
- 10 items in myList.
- each item (Class) has a boolean called renderWhenBlank. This is used to render a blank Option/Value at the top of the
- only 1 item in the middle of the list (myList[5]) has a false in this boolean.
Issue:
- When the 10 render the top 5 SelectLists have a rendered SelectOption at the top of " " (CORRECT);
- and the 6th does not have the top SelectOption (CORRECT);
- but the remaining selectLists 7-10 do not have a top SelectOption. The moment there is a rendered = "False" the next items in the list also incorrectly rendered="false" This is what we want fixed
Secondary Question: Or is this a Salesforce bug!
possible work arounds: javascript updating the style of our blank extra selectOption. Or creating a new variable in our class of type List and not using a global variable (and removing the solo selectOption).
{!item.mySelectOptions}
, which you'll probably want to render as two separate lists (one with and without the blank option) stored in static variables for performance.