0

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>
1

1 Answer 1

0

Use attribute readonly in apex:page

<apex:page sidebar="false" controller="PaginationCon" readonly="true">

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.