You need to sign in to do that
Don't have an account?
R@v!
pagination is not working properly
//Apex Class public class ManagePhasescontroller { Public Integer count {get; set;} Public Integer countRecord {get; set;} public boolean bCounter {get;set;} Public Integer benchSize {get; Set;} public string para{get;set;} public void getselectedbenchmark() { try{ if(MonthAcc.Account__c !=null && selectedPhase != null) selectedbenchmark = [SELECT Responsible__c,Date_Completed__c,Target_Date__c,Objective__c,Phase__c,Sequence__c from Phase_Benchmark__c where Phase__r.Account__c=:MonthAcc.Account__c AND Phase__c = :selectedPhase.Id AND Completed__c=false ORDER BY Sequence__c ASC]; if(selectedbenchmark!=null && selectedbenchmark.size()>0){ benchSize = selectedbenchmark.size(); } count = 0; countRecord = 1; bCounter = true; } catch (Exception e){} } //**Method for incement the counter public PageReference incrementCounter() { count++; countRecord++; bCounter = false; return null; } //**Method for decrement the counter public PageReference decrementCounter() { count--; countRecord--; return null; } //**Method for fetch count value public Integer getCount() { return count; } //VF Page <apex:outputPanel id="thePanel"> <apex:outputPanel styleClass="red" rendered="{!if(selectedPhase!=null,true,false)}" > <apex:pageBlockSection title="Phase Information"> <apex:outputField value="{!selectedPhase.Phase_Number__c}"/> <apex:outputField value="{!selectedPhase.Description__c}"/> <apex:outputField value="{!selectedPhase.Start_Date__c}"/> <apex:outputField value="{!selectedPhase.End_Date__c}"/> </apex:pageBlockSection><br/> <apex:outputPanel rendered="{!if(selectedbenchmark=null,true,false)}" > <center> All Benchmark for this Phase have been Completed.<br/><br/> <apex:commandButton value="Move to Next Phase" action="{!movenextphase}" reRender="MonthlyFrm"/> </center> </apex:outputPanel> </apex:outputPanel> </apex:outputPanel><br/> <apex:outputPanel id="Panel"> <apex:repeat value="{!selectedbenchmark}" var="bench" id="theRepeat" rows="1" first="{!if(count=-1,0 ,count)}"> <apex:outputPanel styleClass="red" rendered="{!if(selectedbenchmark!=null,true,false)}"> <apex:pageBlockSection title="Phase BenchMark"> <apex:outputField value="{!bench.Responsible__c}"/> <apex:outputField value="{!bench.Target_Date__c}"/> <apex:outputField value="{!bench.Objective__c}"/> <apex:outputField value="{!bench.Date_Completed__c}"/> </apex:pageBlockSection><br/> <apex:outputPanel > <center> <apex:outputpanel id="panel2"> <apex:commandButton value="<<" rerender="btn2" disabled="{!if((bCounter=true || count=0),true ,false)}"/> <apex:actionSupport id="btn2" event="onclick" action="{!decrementCounter}" rerender="panel,panel2,out,panel1"/> </apex:outputpanel> <apex:outputPanel > <apex:commandButton value="Complete this Benchmark" action="{!completebenchmark}" reRender="MonthlyFrm,Panel"> <apex:param value="{!bench.Id}" assignTo="{!para}"/></apex:commandButton> </apex:outputPanel> <apex:outputText value="{!countRecord}" id="out"/>/{!benchSize} <apex:outputpanel id="panel1"> <apex:commandButton value=">>" rerender="btn1" disabled="{!if(countRecord=benchSize,true ,false)}"/> <apex:actionSupport id="btn1" event="onclick" action="{!incrementCounter}" rerender="Panel,panel2,out,panel1"/> </apex:outputpanel> </center> </apex:outputPanel> </apex:outputPanel> </apex:repeat> </apex:outputPanel>
You can use below Syntax for pagination, You can also refer working code describe as below,
mark it as answer If it helps you.