I have implemented this code but still it is giving me error
Collection size 9,301 exceeds maximum size of 1,000.
I have Created List of List but it is giving me this error.
Apex Class
public with sharing class PaginationCon {
public List<List<Attachment>> FinalList{get;set;}
public List<Attachment> tempatt{get;set;}
public List<Attachment> att{get;set;}
public PaginationCon ()
{
att =new List<Attachment>();
tempatt=new List<Attachment>();
FinalList=new List<List<Attachment>>();
for(Attachment a:[select id,Name,BodyLength,CreatedDate,Owner.Name from Attachment])
{
tempatt.add(a);
if(tempatt.size()<0)
{
FinalList.add(tempatt);
}
}
FinalList.add(tempatt);
}
}
VisualForce Page
<apex:page sidebar="false" controller="PaginationCon">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script type="text/javascript">
$(function () {
$("#example1").dataTable();
});
</script>
<apex:form >
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>BodyLength</th>
<th>Created Date</th>
<th>Owner Name</th>
<th>Click To View</th>
<th>Click To Delete</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!FinalList}" var="ftlist">
<apex:repeat value="{!ftlist}" var="a">
<tr>
<td> <apex:outputText value="{!a.Name}"/></td>
<td> <apex:outputText value="{!a.BodyLength}"/></td>
<td> <apex:outputText value="{!a.CreatedDate}"/></td>
<td> <apex:outputText value="{!a.Owner.Name}"/></td>
<td> <apex:commandLink value="View"/></td>
<td> <apex:commandLink value="Delete"/></td>
</tr>
</apex:repeat>
</apex:repeat>
</tbody>
</table>
</apex:form>
</apex:page>
apex:repeat
tag. Please read this post, it has a very nice answer. Add more than 1000 picklist values in visualforce page (controller 1000 list items limit) . Also there is a workaround however I would not recommend that. Workaround. Have you considered using pagination as 9000+ plus items will increase your viewstate &make page loading slow