6

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.

  • 1
    Does the user need to be able to edit records in the table or only read? Have you checked out StandardSetControllers? – greenstork Apr 28 '14 at 20:10
  • Thanks @greenstork. I have updated the question. The table is read only. Kindly review it. – Bforce Apr 28 '14 at 20:20
  • @Bhaskaran S I have got the same requirement, can you please share your code? Thanks – user13261 Nov 20 '14 at 11:19
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. – superfell Nov 20 '14 at 17:24
7

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.

  • Thanks a lot Mark Pond. This is a fantastic solution and also great notes to keep as a reference always. I have added readOnly attribute as per your suggestions and its working for me. Thanks again. – Bforce Apr 29 '14 at 4:51
  • 1
    @BaskaranS And if you get over 10,000 records, here is one example of code that can handle that force201.wordpress.com/2014/03/15/…. – Keith C Apr 29 '14 at 10:51
  • Hi Keith, Thanks a lot for the example code. I am going to implement this for the above issue. – Bforce Apr 29 '14 at 10:57
2

You will need to perform this action using AJAX. Have jQuery perform the call out and load the data of the returned call out into the jquery datatable. That should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.