1

I've created a class and VF markup to try and pull phone extensions from a custom object to display of our homepage. The code words well except it limits the results to only 20. Is there a way to tell it to display all records?

public class GetExtensions {
// ApexPages.StandardSetController must be instantiated
// for standard list controllers
public ApexPages.StandardSetController setCon {
    get {
        if(setCon == null) {
            setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                [SELECT Id, Name, Extension__c FROM SFDC_Employee__c WHERE Title__c != 'Podiatrist' AND Employee_Status__c = 'Active (Commenced)' AND Location__c = 'Head Office' ORDER BY Name ASC]));

        }
        return setCon;
    }
    set;
}

// Initialize setCon and return a list of records
public List<SFDC_Employee__c> getextensions() {
    return (List<SFDC_Employee__c>) setCon.getRecords();
}

}

2
  • 1
    Can you paste your code? Also can you check how many records are displayed if you open it directly by going to '/apex/yourPageName'?
    – Sam
    Commented Feb 3, 2015 at 7:53
  • Thanks for the help. custom controller added to question Commented Feb 6, 2015 at 3:40

2 Answers 2

2

I ran into the same issue, and the following solution worked for me, adding setPageSize(setCon.getResultSize()):

// Initialize setCon and return a list of records
public List<SFDC_Employee__c> getextensions() {
    setCon.setPageSize(setCon.getResultSize());
    return (List<SFDC_Employee__c>) setCon.getRecords();
}

Hope this helps!

0
0

you can only show 20 records at a time using recordsetvar use custom controller to show more.

1
  • 2
    Please provide some official documentation to prove your answer. Thank you. Commented Feb 3, 2015 at 12:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .