You need to sign in to do that
Don't have an account?
Need Help on Pagination:
Hi,
I have been working on pagination on my vf page. The issue i am stuck right now is , though i click the next button the page doesnt gets to the next set of records. It only shows the initial set of records i set by setPageSize.
Not sure what i am missing . please help.
VF Code:
<apex:page controller="setTestController">
<apex:form>
<apex:dataTable value="{!RetirieveProducts}" var="products" styleClass="list" id="productsLstTable" rules="rows">
<apex:column >
<apex:facet name="header"><b>Product Name</b></apex:facet>
<apex:outputText value="{!products.name}"/>
</apex:column>
</apex:datatable>
<apex:panelGrid columns="4" id="pnlGrid">
<apex:commandLink action="{!con.next}" rendered="{!con.hasNext}">Next</apex:commandlink>
</apex:panelGrid>
</apex:form>
</apex:page>
Controller:
public class setTestController{
public ApexPages.StandardSetController con{get; set;}
public string soql{get;set;}
public List<product2> RetirieveProducts{get;set;}
public void paginationMethod(){
soql='select id,name from product2 where Id != null and Third_Party_Vendor__c = null';
con = new ApexPages.StandardSetController(Database.getQueryLocator(soql));
con.setPageSize(5);
for(Product2 p : (List<Product2>)con.getRecords())
{
RetirieveProducts.add(p);
//lstProducts.add(new ProductWrapper(p));
}
}
public setTestController(){
RetirieveProducts=new List<Product2>();
paginationMethod();
}
public Boolean getHasNext {
get {
return con.getHasNext();
}
}
public void next() {
con.next();
}
}
this will helps you:
http://boards.developerforce.com/t5/Visualforce-Development/VF-pagination-Modified-rows-exist-in-the...