+ Start a Discussion
Tyler McCartyTyler McCarty 

Pagination with with a table based on a query

Hello, Im on the last part of this assignment and can't seem to find a way to get pagination to work with this table. I have a table that is filtered with a dropdown list. When i choose a dropdown selection the correct information will display and pagination will be accurate. But when I go to choose a different dropdown selection nothing happens.
I've posted the relevant code below. Everything else works fine. 

<apex:inputfield value="{!filterAccount.Type}" label="Account Type"> 

 <apex:actionSupport event="onchange" action="{!updateRecordList}" rerender="pwPanel"/>      
           
               </apex:inputfield>
   <br/><br/><br/>
            <!-----------Table---------->                  
<apex:outputPanel rendered="{!recordList.size > 0}" id="account_filter">

      <apex:pageBlockSection >

<apex:pageBlockTable value="{!Accounts}" var="rl" id="record_list">


    //pagination  
    public ApexPages.StandardSetController setcon 
    {
        get
        {
            if(setCon == null)
            {

                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [Select Name, Type, Website, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry  
                    from Account where type =:filterAccount.type Order by Name ASC Limit 10000]));
                setCon.setpageSize(pageSize);
                noOfRecords = setCon.getResultSize();

            }
            return setCon;
        }
        set;
        
    }

    // Initialize setCon and return a list of record    

    public List<Account> getAccounts() {  

       return setCon.getRecords();
    }
    
       //fields returning for table
  public void updateRecordList()
    {
       recordlist = setCon.getrecords();
    }