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
@taani.ax1426@taani.ax1426 

Standard list controller

HI,

 

I read lots of things about standard list controller, but still coudn't understand logic behind that. Just understood one line from chapter VI, "Standard list controllers allow you to create Visualforce pages that can display or act on a set of records.".Couldn't find that whats the need and where it to be used.

 

Help me to understand.

 

Thanks,

taani

Best Answer chosen by Admin (Salesforce Developers) 
PremanathPremanath

If i want to Display set of records in one object using vf page.

Without using controller we have to achive that functionality.

 

See this example....

 

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{!accounts}" var="a">
<apex:column value="{!a.name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

 

And we can edit  Multiple Opportunities records on a Single Page...

 

 

<apex:page standardController="Opportunity"
recordSetVar="opportunities"
tabStyle="Opportunity" sidebar="false">
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save"
action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!opportunities}"
var="opp">
<apex:column value="{!opp.name}"/>
<apex:column headerValue="Stage">
<apex:inputField value="{!opp.stageName}"/>
</apex:column>
<apex:column headerValue="Close Date">
<apex:inputField value="{!opp.closeDate}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

All Answers

PremanathPremanath

If i want to Display set of records in one object using vf page.

Without using controller we have to achive that functionality.

 

See this example....

 

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{!accounts}" var="a">
<apex:column value="{!a.name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

 

And we can edit  Multiple Opportunities records on a Single Page...

 

 

<apex:page standardController="Opportunity"
recordSetVar="opportunities"
tabStyle="Opportunity" sidebar="false">
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save"
action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!opportunities}"
var="opp">
<apex:column value="{!opp.name}"/>
<apex:column headerValue="Stage">
<apex:inputField value="{!opp.stageName}"/>
</apex:column>
<apex:column headerValue="Close Date">
<apex:inputField value="{!opp.closeDate}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

This was selected as the best answer
@taani.ax1426@taani.ax1426

Thanks, that was in simple term. I understood the point..