[SalesForce] Used jQuery datatable for pagination and got this issue: Collection size 1,378 exceeds maximum size of 1,000

I have implemented client side pagination using jQuery datatable for pagination and got this issue: Collection size 1,378 exceeds maximum size of 1,000.

This resultant list of records is from a webservice response. So, the response is giving me more than 1000 records in the list. Its all real-time query of SAP webservice. There is no SOQL and is only custom class list. I have used pageblocktable.

Experts advice please.

Best Answer

If you choose to use the <apex:pageBlockTable /> to render your table you are normally limited to 1000 items in the collection that it iterates over.

If you set the readOnly attribute on the <apex:page tag with a true value - this limit is increased to 10,000 records in the collection.

<apex:page readOnly="true" ...>
    <!-- your markup with not more than 10,000 items in the collection -->
</apex:page>

If you have more than 10,000 records in your webservice response collection, you will need to do this client-side with an ajax request and then populate the page with a table on your own, not using a pageBlockTable tag.

Salesforce Documentation - apex:page tag

readOnly: A Boolean value that enables read-only mode for a Visualforce page. In read-only mode, a page may not execute any DML operations, but the limit on the number of records retrieved is relaxed from 50,000 to 1 million rows. It also increases the number of items in a collection that can be handled by iteration components, from 1,000 to 10,000. If not specified, this value defaults to false.