[SalesForce] How to display more than 5000 records in pageblock table with out pagination..

On my Visualforce page I've to display more than 5000 records with checkboxes like the following :enter image description here

Here I'm getting 6781 records, but on my vf page it was displaying 100 records only. If I use PAGINATION then I've to select the records which is belongs to that page only. As per my requirement user can select any of the 6781 accounts at a time. Is there any possible way to display all the records in same vf page with side bar.

Best Answer

You can see a deeper discussion here: Maximum number of collection items that can be iterated in an iteration component limit in salesforce

The basic idea is that a Map allows you to iterate basically as many components as you want. View state is still an issue, and I think the requirement to view so many records is completely ridiculous. But it is technically feasible.

In your controller, us a Map<Id, SObject>, or Map<Id, SomeWrapper>, as you like:

public Map<Id, Wrapper> wrappers { get; private set; }

Then on your page you should be able to loop over all of the records:

<apex:pageBlockTable value="{!wrappers}" var="wrapper">
    <apex:column>
        <apex:inputCheckbox value="{!wrapper.isSelected}" />
    </apex:column>
    <apex:column value="{!wrapper.record.SomeField__c}" />
</apex:pageBlockTable>

You'll lose the ability to control order if you take this approach.

Related Topic