You need to sign in to do that
Don't have an account?
MarkInAtlanta
Visualforce - variable selectList / selectOptions
I have a visualforce page, with a table of products, and a dropdown to allow the UOM (unit of measure) to be set. Some products can only be ordered in EACH, some in either EACH or CASE. The checkbox on the Product record: Full_Case_OK__c indicates this.
So, I added a "rendered" to the selectOption to only allow the correct UOM to show up in the optionlist..
<apex:pageBlockTable id="caseProductsTable" value="{!caseProductList}" var="r" rendered="{!caseProductList.size > 0}">
...
some other columns
...
<apex:column>
<apex:facet name="header">
<apex:outputPanel >
... some stuff for sorting options, etc..
</apex:outputPanel>
</apex:facet>
<apex:selectList value="{!r.caseProduct.Quantity_UOM__c}" size="1" rendered="{!NOT(r.disabled)}">
<apex:selectOption itemLabel="Each" itemValue="Each"/>
<apex:selectOption itemLabel="Case" itemValue="Case" rendered="{r.caseProduct.Product__r.Full_Case_OK__c}"/>
</apex:selectList>
</apex:column>
...
some more columns
...
</apex:pageBlockTable>
Issue is that the list of options gets tied to the first product in the table, not generated for each product as I expected.
Is there another way i should handle a variable select list? any suggestions?
So, I added a "rendered" to the selectOption to only allow the correct UOM to show up in the optionlist..
<apex:pageBlockTable id="caseProductsTable" value="{!caseProductList}" var="r" rendered="{!caseProductList.size > 0}">
...
some other columns
...
<apex:column>
<apex:facet name="header">
<apex:outputPanel >
... some stuff for sorting options, etc..
</apex:outputPanel>
</apex:facet>
<apex:selectList value="{!r.caseProduct.Quantity_UOM__c}" size="1" rendered="{!NOT(r.disabled)}">
<apex:selectOption itemLabel="Each" itemValue="Each"/>
<apex:selectOption itemLabel="Case" itemValue="Case" rendered="{r.caseProduct.Product__r.Full_Case_OK__c}"/>
</apex:selectList>
</apex:column>
...
some more columns
...
</apex:pageBlockTable>
Issue is that the list of options gets tied to the first product in the table, not generated for each product as I expected.
Is there another way i should handle a variable select list? any suggestions?
sfdcsushil
You will have to use some onchange event on product list which should rerender select list.