You need to sign in to do that
Don't have an account?
Abhishek Singh 88
next link navigation is not working in pagination
here i have a table
so after clicking on customer id i have to show related records.so for that i have implemented pagination.
here is my apex class:
here is my VF page
But the problem is,i am not able to refresh the fresh data,means when i am clicking on nex button it showing only those old records.
any suggestion will be appriciated.
so after clicking on customer id i have to show related records.so for that i have implemented pagination.
here is my apex class:
public ApexPages.StandardSetController setCon //pagignation for customer incident { get{ if(setcon==null) { size=10; string queryString = 'select id,Name,BMCServiceDesk__shortDescription__c,PHS_Category__c,PHS_Sub_Category__c,BMCServiceDesk__FKStatus__c from BMCServiceDesk__Incident__c where account__r.customerId__c=:currentSiteCust'; setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString)); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; }set; } public Boolean hasNext { get { return setCon.getHasNext(); } set; } public void first() { setcon.first(); } public void last() { setcon.last(); } public void previous() { setcon.previous(); } public void next() { setcon.next(); } public pagereference searchincidents()//getting records from setcon { for(BMCServiceDesk__Incident__c a : (List<BMCServiceDesk__Incident__c >)setCon.getRecords()) { custincidentLst.add(a); } return null; }
here is my VF page
<apex:pageBlock title="Incidents" rendered="{!showIncidents}" id="pb"> <apex:pageblocktable value="{!custincidentLst}" var="inci"> <apex:column headerValue="Name"> <apex:outputField value="{!inci.Name}"/> </apex:column> </apex:pageblocktable> <apex:panelGrid columns="7"> <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!first}" disabled="{!!setcon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!previous}" disabled="{!!setcon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!next}" disabled="{!!setcon.hasnext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!last}" disabled="{!!setcon.hasnext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText> <apex:outputPanel style="color:#4AA02C;font-weight:bold"> <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/> </apex:outputPanel> </apex:panelGrid> </apex:pageblock>
But the problem is,i am not able to refresh the fresh data,means when i am clicking on nex button it showing only those old records.
any suggestion will be appriciated.
Use below code as follow.
Step1: Creaet class with this code:
Setp 2: Create below code with this code
Step 3: Create Visual force page with following code.
Hope this will solve your Issue.
Make it best if its work for you.
Thanks
karthik
All Answers
Use below code as follow.
Step1: Creaet class with this code:
Setp 2: Create below code with this code
Step 3: Create Visual force page with following code.
Hope this will solve your Issue.
Make it best if its work for you.
Thanks
karthik
According to your code you have to add one more methid in you controller called "referesh like below invoke the method using command button manually. that referesh your list and fetch new created records.
public pageReference Reload() {
setCon = null;
getAccounts();
setCon.setPageNumber(1);
return null;
}
in VF page
<apex:commandButton status="UpdateRecords" reRender="pb" value="Reload" action="{!Reload}"/>
Hope this will help you.
Mark Best ANSWER if its work for you.
Thansk
karthik
here is table
so there are total 14 records,10 is page size.
but when i am clicking on nex button
it showing
but records are not refreshing.
Check the Div is not having the close tag </div>
also share the Controller method for next()
Thanks
karthik
and i checked div tag,it is closed,it was mistake in pating code.
I used your code just changed the Object name its working Perfect. consider those images.
Thanks