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
raju p 4raju p 4 

Collection size 10,028 exceeds maximum size of 10,000.

even also i am using readonly  atribute ,  geting same error please do the needful,

Collection size 10,028 exceeds maximum size of 10,000. 

<apex:page controller="Leaddisplay" readOnly="true">

       <apex:pageBlock >
           <apex:DataTable value="{!ld}" var="a">
               <apex:column value="{!a.Lastname}"  headerValue="LastName"/>
            <apex:column value="{!}"  headerValue="companyName"/>
               <apex:column value="{!a.status}"  headerValue="LeadStatus"/>
                     <apex:column value="{!}"  headerValue="phone"/>

public class Leaddisplay {
    public list<lead>ld{set;get;}
    public Leaddisplay(){
       // ld= new list<lead>();
       ld=[select  lastname,phone,company,status from lead];


The limit to iterate over a collection on a visualforce page is 10,000 when readOnly attribute is set to true. You can go through the documentation for readOnly attribute to know more details:

You will have to implement pagination to work on records more than 10,000.
raju p 4raju p 4
Yes, Agree by salesforce documentation we can use readonly as true, i used that one also,
Ramkumar RRamkumar R

Use 2 data tables with 2 different collections as value or

Use nested data tables with Map<Integer, List<DisplayValue>>- first data table iterates the map keys, 2nd iterates the list of display value. Make sure the size of list<DisplayValue>not exceeding 10,000. The next set of 10,000 values you can store in next map key, This way you can display upto 10,000*10,000 values.
Laquita ScholzLaquita Scholz
A commitment of appreciation is all together for the update and quick reply. Bet upon your string. A commitment of appreciation is all together for making it. Appreciative for sharing such mind blowing information. MyPaymentPlus (