You need to sign in to do that
Don't have an account?
DarkLight
apex:repeat limit to 1000 even though page is in read-only mode
I try to get a list of all cases (we have about 3,600 of them).
I use a custom controller and an apex page.
notice that the controller calls many columns from case and account objects using SOQL.
I set readOnly="true" and get only 1000 results in the output.
I use a custom controller and an apex page.
notice that the controller calls many columns from case and account objects using SOQL.
I set readOnly="true" and get only 1000 results in the output.
how can I overcome this?
Many thanks in advance
These are my codes:
==============================================================
APEX Page:
==============================================================
<apex:page Controller="AllCasesCon" readOnly="true">
Many thanks in advance
These are my codes:
==============================================================
APEX Page:
==============================================================
<apex:page Controller="AllCasesCon" readOnly="true">
<apex:includescript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"/>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="allcasestable">
<thead>
<tr>
<th>Case Number</th>
<th>Subject</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Case Number</th>
<th>Subject</th>
</tr>
</tfoot>
<tbody>
<apex:repeat value="{!AllCasess}" var="ac" rows="4000">
<tr>
<td>{!ac.caseNumber}</td>
<td>{!ac.subject}</td>
</tr>
</tr>
</apex:repeat>
</tbody>
</table>
</apex:page>
==============================================================
controller:
==============================================================
public class AllCasesCon {
private List<Schema.Case> allCasess;
public List<Schema.Case> getAllCasess()
{
allCasess = [Select case.Id, case.CaseNumber, case.Subject, Submitted_By__c,CreatedDate,
Last_Modified_incl_Comments__c,LastModifiedDate,Bug_number__c,Status,Support_members__c ,
Support_Responsibility__c, description,Priority, Non_GA_related__c, HasCommentsUnreadByOwner,
Close_case_description__c, case.account.id, case.account.Name, case.account.Technical_Account_Manager__c,
case.account.Technical_Director__c,case.account.Under_annual_support_program__c From Case
order by LastModifiedDate desc LIMIT 10000];
return allCasess ;
}
@istest public static void testAllCasesCon() {
AllCasesCon control = new AllCasesCon();
System.AssertNotEquals (control.getAllCasess(), null);
}
}
==============================================================
controller:
==============================================================
public class AllCasesCon {
private List<Schema.Case> allCasess;
public List<Schema.Case> getAllCasess()
{
allCasess = [Select case.Id, case.CaseNumber, case.Subject, Submitted_By__c,CreatedDate,
Last_Modified_incl_Comments__c,LastModifiedDate,Bug_number__c,Status,Support_members__c ,
Support_Responsibility__c, description,Priority, Non_GA_related__c, HasCommentsUnreadByOwner,
Close_case_description__c, case.account.id, case.account.Name, case.account.Technical_Account_Manager__c,
case.account.Technical_Director__c,case.account.Under_annual_support_program__c From Case
order by LastModifiedDate desc LIMIT 10000];
return allCasess ;
}
@istest public static void testAllCasesCon() {
AllCasesCon control = new AllCasesCon();
System.AssertNotEquals (control.getAllCasess(), null);
}
}
All visualforce repeat/table componenents are currently limited to 1000. This includes apex:repeat, apex:dataTable, apex:pageBlockTable, etc. They only thing you can really do is create list of lists and then roll your own dataTable and copy the pageblock styling.
Thanks for the quick reply -
however, I quote below from your user guide:
http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_controller_readonly_context.htm|StartTopic=Content%2Fpages_controller_readonly_context.htm|SkinName=webhelp
In addition to querying many more rows, the
readOnly attribute also increases the maximum number of items in a collection that can be iterated over using components such as <apex:dataTable>,<apex:dataList>, and <apex:repeat>
. This limit increased from 1,000 items to 10,000. Here is a simple controller and page demonstrating this:
If for some reason the above is not supported (as stated by Abhay Arora's comment) please provide me with a fix to the controller in my original question.
Many thanks,
Tal
Check your viewstate and make sure that all the records are being returned? Perhaps there's some sort of glitch in the system? Your code looks reasonable, and I see no reason why it wouldn't work.
everything looks fine on my side. this problem occur on every terminal, for every user, any time.
Please let me know if you stand behind your documentation.
If my approach will not work, please elaborate on Abhay's reply from above:
"They only thing you can really do is create list of lists and then roll your own dataTable and copy the pageblock styling"
I am not able to find official info on this approach.
Thanks,
Tal
Hi ,
@darklight "everything looks fine on my side. this problem occur on every terminal, for every user, any time." what do you mean ?
Do you mean that it works on your terminal and not on others?
Please check
http://boards.developerforce.com/t5/Visualforce-Development/Return-more-then-1000-records-for-DataTable/m-p/167674#M21023
Above states that
"
Appologies if the docs and release notes are a little unclear on this.
While the limit of 1000 items in collections was relaxed in Spring '10, there is still a limit of 1000 items that can be iterated over in VF pages. Generaly speaking, when displaying large collections to users, you should aim to paginate such large data sets. Part of this is just good UI design. The other part has to do with us needing to protect the infrastructure from having to render potentially huge pages.
"
And below is the workaround
http://boards.developerforce.com/t5/Visualforce-Development/Getting-around-1000-record-collection-size-limit-in/td-p/204419
http://boards.developerforce.com/t5/Apex-Code-Development/How-to-display-the-Records-more-than-1000-in-visual-force-page/td-p/372405
Thanks for the clarification,
I want to get all ~3,600 cases to a jQuery DataTables.net table to have post processing filters and pagination, and avoid using Salesforce native views.
Per the VF documentation, it clearly states:
In addition to querying many more rows, the readOnly attribute also increases the maximum number of items in a collection that can be iterated over using components such as <apex:dataTable>, <apex:dataList>, and <apex:repeat>. This limit increased from 1,000 items to 10,000.
My code above does exactly this:
Iterates over a collection of 1000<X<10,000 cases, in readonly mode.
I am not sure what am I doing wrong, and I appreciate any help I can get.
Another possibility is using the DataTables.net pagination to get records dynamically, I just don't know how to do that.
I already embedded a jQuery table in account pages and it looks great.
https://lh6.googleusercontent.com/cL3w2Hv8xHWaZY-qqMeHANaLuJaSmc4jXu4dOshrMIt_4MNpTCbpOwlEkmP9QGqKKOoD7J2rvS8
Notice that in my code above I removed all JS notations, and inluded readonly in apex:page. Still - the result dataset was exactly 1000 cases.
Thanks,
Tal
more info that can be relevant:
I ran the console and saw this line:
[7]|this.allCasess|"List of size 1000 too large to display"|0x110673cb
https://lh3.googleusercontent.com/GpMoF5bYViM1o8svkwErz4ETEIzvPdSOyckWzO2T2EL99FBtGwMqenursGHyoTp7TcAe0Xe-zGU
"List of size 1000 too large to display" means that, despite your best intentions, your list only has 1000 items within it (and not the ~3600). So, it sounds like you need to check your query, and also the version of your code. Older API versions only supported up to 1000 list items. Try changing your API version on your code to at least version 23.0 for both the page, and any controllers or extensions you are using.
The query in the controller returns with 3684 record, as you can see from the Force.com Explorer window:
https://docs.google.com/open?id=0B4ROjlbeG769Z2syZGgtNHNqR1U
both the controller (that uses the same SOQL query) and the page are on API v24
=================================================================================
I can't see your screenshots, but I get what you're saying. I just tested both a repeat and pageBlockTable tag with a query of 5000 opportunities in my test org, and it works as expected. Can you post your code here so we can look at it, or a sample piece that shows the issue?
my full controller is in the first post.
the apex page is also in the first post.
I can set a remote session to show the actual issue -
Please let me know if this is possible on your end
Oops. Missed that part. Let me build that into a test scenario in my dev org today, and I'll get back in touch with you.
Hi ,
I have tried your code with a generic list of contact and i was able to see the data all 9999 items on page
I added some columns to my query and now I get only 250 records!
what is the official limitation?!
http://screencast.com/t/eiJtMEy8AC