+ Start a Discussion
Rohit SharmaGRohit SharmaG 

Display more than 10k records in VF page

Hello All,

I would like to display 30k records in the VF page. But as per the Governer limit we can not display 10k with pageblock and repeat.

My list having near 40k records.

please assist on this.

Rohit Sharma
Vikash TiwaryVikash Tiwary
Hi Rohit,

You can use pagination where you load the data in chunks say 10,000 if the page is readonly. Also you can use remote methods to get the recored and fill it in table using javascript. Data returned via remote methods do not contribute to governor limit.

Hope this helps!

James LoghryJames Loghry
The iterator in Visualforce can only handle <= 10,000 records.  However, apex can handle more than this.  One trick you can use is to create a "List of Lists", and then nest your apex:repeat elements to iterate over them in Visualforce.  In apex, your code may look like the following:

List<List<String>> myNestedStringList = new List<List<String>>();
Integer i=0;
List<String> currentList = null;
for(sObject sobj : sobjectList){
        currentList = new List<String>();
    //Add string to inner array

Your visualforce would look something like:

<apex:repeat var="outerList" value="{!myNestedStringList}">
    <apex:repeat var="myStr" value="{!outerList}">
        <apex:outputText value="{!myStr}" />

Please note that storing several records in your Visualforce page / Controller may blow your View State size out of the water, however, so you should be careful with this approach.