apex:selectList with standard list Controller –



What is <apex:SelectList> tag?


Apex:selectList is used to display list options that allows user to select one.more values at a time. See below Syntax to use apex:select list
<apex:selectList size=”1″ value=”{!filterId}”>
<apex:actionSupport event=”onchange” reRender=”oppList”/>
<apex:selectOptions value=”{!listviewoptions}”/>
</apex:selectList>
Know more about selectList
Below is the simple example to display list of records in visualforce page with list view & actions.
<apex:page standardController="Opportunity" recordSetVar="opportunities">
<apex:form >
<apex:pageBlock title="Displaying Opportunities">

<!-- Below <ape:selectList> tag is used to display listview -->

<apex:selectList size="1" value="{!filterId}">
<apex:actionSupport event="onchange" reRender="oppList"/>
<apex:selectOptions value="{!listviewoptions}"/>
</apex:selectList>

<!-- below code displays list of opportunnities -->

<apex:pageBlockTable value="{!opportunities}" var="opp" id="oppList">
<apex:column value="{!opp.Name}"/>
<apex:column value="{!opp.Account.Name}"/>
<apex:column value="{!opp.StageName}"/>
<apex:column value="{!opp.Type}"/>
<apex:column value="{!opp.ExpectedRevenue}"/>
</apex:pageBlockTable>

<!-- Using List action to display first, last, next & previous list -->

<apex:pageBlockButtons location="Bottom">
<apex:commandLink value="First" action="{!First}"/> &nbsp;
<apex:commandLink value="Next" action="{!Next}"/> &nbsp;
<apex:commandLink value="Previous" action="{!Previous}"/> &nbsp;
<apex:commandLink value="Last" action="{!Last}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget