function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
❤Code❤Code 

Pagination Not working

I am trying to do pagination. But it is not working. Can anyone let me know where i am wrong -
Below is the apex class -
 
public with sharing class wrapper_test_controller {
public list<wrapperclass> wrapperelement_for_account{get;set;}
public list<wrapperclass> wrapperelement_for_contact{get;set;}
public string selectedproductfamily {get;set;}
    public String qryString;

    private integer totalRecs = 0;
private integer OffsetSize = 0;
private integer LimitSize= 2;
public list<product2> queryResult{get;set;}

    public Work_Order_Item__c service1 {get;set;}

public List<SelectOption> getproductfamily(){

}

    public PageReference query() {
    system.debug('@@@'+selectedproductfamily);


        if(selectedproductfamily!='Any Type'){
         qryString = 'SELECT Id,name,family,Measurement_Type__c,Cleaning_Unit_Price__c,Treatment_Unit_Price__c,(select Service__c,Quantity__c,Length__c,Width__c from work_order_items__R) FROM product2 WHERE ' +

            '(Family like \'%' + selectedproductfamily + '%\')';
        }else{

         qryString = 'SELECT Id,name,family,Measurement_Type__c,Cleaning_Unit_Price__c,Treatment_Unit_Price__c,(select Service__c,Quantity__c,Length__c,Width__c from work_order_items__R) FROM product2';

        }
        queryResult = Database.query(qryString);

        return null;

    }

    public wrapper_test_controller (ApexPages.StandardController controller) {


 }



//
public void FirstPage()
{
OffsetSize = 0;
query();
}
public void previous()
{
OffsetSize = (OffsetSize-LimitSize);
query();
}
public void next()
{
OffsetSize = OffsetSize + LimitSize;
query();
}
public void LastPage()
{
OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
query();
}
public boolean getprev()
{

if(OffsetSize == 0){

return true;
}
else {

return false;
}
}
public boolean getnxt()
{
if((OffsetSize + LimitSize) > totalRecs){

return true;
}
else {

return false;
}
}
//////    


}