I am using standardsetcontroller
for pagination. But it's not working properly. It's showing previous, next buttons correctly but records showing all the records, not shown what given in set.pageSize limit.
Page:
<apex:pageBlock id="details">
<apex:pageBlockButtons >
<div align="right">
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}" >Previous</apex:commandlink>
<apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
</div>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!lstIssue}" var="issue">
<apex:column headervalue="Action">
<apex:outputLink value="{!URLFOR($Action.ADI_Issue__c.Edit,issue.Id)}">Edit</apex:outputLink>
</apex:column>
<apex:column headervalue="Name">
<apex:outputLink value="{!URLFOR($Action.ADI_Issue__c.View,issue.Id)}">{!issue.Name}</apex:outputLink>
</apex:column>
<apex:column headervalue="Record Type" value="{!issue.RecordType.Name}"/>
<apex:column headervalue="Project" value="{!issue.Project__r.Name}"/>
<apex:column headerValue="Business Unit" value="{!issue.Business_Unit__c}"/>
<apex:column headerValue="Status" value="{!issue.Status__c}"/>
<apex:column headervalue="Requested Resolution Date" value="{!issue.Requested_Resolution_Date__c}"/>
<apex:column headervalue="Assigned To" value="{!issue.Assigned_To__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
Controller:
public with sharing class ADI_IssueHomeController{
public ApexPages.StandardSetController con {
get;
set;
}
public ADI_IssueHomeController() {
getIssueList();
}
public void getIssueList(){
string strQuery1 = 'select id,name,Issue_Description__c,Business_Unit__c,Status__c,Requested_Resolution_Date__c,Assigned_To__c,Assigned_To__r.Name,RecordType.Name,Project__r.Name from ADI_Issue__c order by LastModifiedDate DESC';
lstIssue=Database.query(strQuery1);
Con = new ApexPages.StandardSetController(lstIssue);
con.setPageSize(15);
}
public Boolean hasNext {
get { return con.getHasNext(); }
set;
}
public Boolean hasPrevious {
get { return con.getHasPrevious(); }
set;
}
public void previous() {
this.con.previous();
}
public void next() {
this.con.next();
}
}