You need to sign in to do that
Don't have an account?
street
Retrieve all the records from custom object
I have a requirement to retrieve all the records from "Customer" object and to display them on Visualforce page.
Where "Customer" contains aroung 4000 to 5000 records.
Hi
You can use Standardsetcontroller to display 2000 records per page and then you have
to go for pagination for the rest of records,Please refer the following link for standardsetcontroller
http://www.salesforce.com/us/developer/docs/pages/Content/apex_pages_standardsetcontroller.htm.
Thanks
Can you help me out with a sample code... how actually its works.
Hi
You can implement the Standardsetcontroller in this way
page
<apex:page controller="opportunityList2Con">
<apex:pageBlock >
<apex:pageBlockTable value="{!opportunities}" var="o">
<apex:column value="{!o.name}"/>
<apex:column value="{!o.closedate}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Class :
public class opportunityList2Con {
// ApexPages.StandardSetController must be instantiated
// for standard list controllers
public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select name,closedate from Opportunity]));
}
return setCon;
}
set;
}
// Initialize setCon and return a list of records
public List<Opportunity> getOpportunities() {
return (List<Opportunity>) setCon.getRecords(); }}
Thanks
Its not helping me out....just it retrieving 19 records...
// ApexPages.StandardSetController must be instantiated
// for standard list controllers
public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[select name,Verification_Date__c,Bank__c from account]));
}
return setCon;
}
set;
}
// Initialize setCon and return a list of records
public List<account> getOpportunities() {
return (List<account>) setCon.getRecords();
}
}