+ Start a Discussion

Cases list view only displaying 20 Case limit

My Cases Homepage list is only displaying 20 Cases. Even though I have not stipulated a limit to display is there some default to how Visualforce displays lists?


Here is my page code:


<apex:form id="theForm"> <apex:pageBlock title="Cases Home"> <b>You are viewing {!$User.FirstName} {!$User.LastName}'s Open and Closed Trouble Tickets</b> </apex:pageBlock> </apex:form> <apex:form > <apex:pageBlock > <apex:pageBlockButtons location="top"> <apex:commandButton action="/apex/CustomerPortalNewCase" value="Create New Case" id="newCaseButton"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!cases}" var="c" id="c_table"> <apex:column headervalue="Case Number"> <apex:outputLink value="/{!c.Id}" target="_self">{!c.casenumber}</apex:outputLink> </apex:column> <apex:column headervalue="Subject"> <apex:outputLink value="/{!c.Id}" target="_self">{!c.subject}</apex:outputLink> </apex:column> <apex:column headervalue="Priority"> <apex:outputField value="{!c.priority}"/> </apex:column> <apex:column Value="{!c.status}" style="{!IF(c.Status='New', 'color:brown;font-weight: bold',IF(c.Status='In Progress', 'color:green;font-weight: bold',IF(c.Status='On Hold','color:red;font-weight: bold',IF(c.Status='Get Acceptance','color:blue;font-weight: bold',IF(c.Status='Closed','color:clack;font-weight: bold','color:grey')))))}"/> <apex:column headervalue="Created By"> <apex:outputField value="{!c.createdbyID}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock > <apex:pageBlockSection > <c:CaseQuickTipsGuideComponent /> <c:CaseAttachmentsInstructions /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>




Best Answer chosen by Admin (Salesforce Developers) 
I ended up just using the commandLink for Previous and Next.

All Answers


Yes there is a default.


It is more than you are interested in, but you can take a look at this



There appears to be a method called setPageSize(). Do it work or not, I don't know. I use my own pagination mechanism.

I ended up just using the commandLink for Previous and Next.
This was selected as the best answer


Can you please share the code how you using commandLink to list previous and next. 

I have a list of  250 records. I want to use previous(<<) and next (>>) 


If you are using a standardController you can simply add this:

<apex:pageBlock> <apex:panelGrid columns="2" style="font-weight: bold;"> <apex:commandLink action="{!previous}" rendered="{!hasPrevious}"><font color="blue">Previous</font></apex:commandLink> <apex:commandLink action="{!next}" rendered="{!hasNext}"><font color="blue">Next</font></apex:commandLink> </apex:panelGrid> </apex:pageBlock>

 If you are using a customerController or an extension the pagination inside the VF page may not work and so you will need to add it to your controller or extension:



public with sharing class CaseListController { public ApexPages.StandardSetController setCon {get;set;} public Boolean hasNext {get; private set;} public Boolean hasPrevious {get; private set;} public CaseListController(ApexPages.StandardSetController setCon) { this.setCon = setCon; this.setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, CaseNumber, Subject, CreatedById, Priority, Status, Contact.Name, CreatedDate From Case Order By CreatedDate Desc LIMIT 10000])); this.setCon.setPageSize(25); setNextPrevious(); } public List<Case> getCases() { return (List<Case>) setCon.getRecords(); } public PageReference next() { if (hasNext) setCon.next(); setNextPrevious(); return null; } public PageReference previous() { if (hasPrevious) setCon.previous(); setNextPrevious(); return null; } private void setNextPrevious() { if (setCon.getHasNext()) { hasNext = true; } else { hasNext = false; } if (setCon.getHasPrevious()) { hasPrevious = true; } else { hasPrevious = false; } } }

 This also has the Sort by in descending order as normal sort by order is ascending. 




Thanks for the quick response.

I have multiple list in the controller that I am displaying. Do I have to have this code for each list?

Good question. Not sure about multiple lists. I think if you include the commandLink portion on your VF page where you have different lists and go with the one write up in your controller it should suffice.