You need to sign in to do that
Don't have an account?

StandardSetController and Pagination
I have a page with a field for zip codes, that once submitted, will return a pageBlockTable with info. I'm having trouble returning a list once I submit. I'm new to StandardSetController and pagination. Any help would be much appreciated.
Here's my VF:
<apex:form > <apex:pageBlock title="Search by Zip"> <apex:inputText value="{!zips}" /> <apex:commandButton value="Search" action="{!find}" /> </apex:pageBlock> <apex:pageBlock title="Nearby Company/Branch" rendered="{!zips != null}"> <apex:pageBlockTable id="accountTable" value="{!accounts}" var="acct"> <apex:column headerValue="Company/Branch"> <apex:outputLink value="/{!acct.Id}" target="_top">{!acct.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Address" colspan="2"> <apex:outputText >{!acct.BillingStreet}, {!acct.BillingCity}, {!acct.BillingState}, {!acct.BillingPostalCode}</apex:outputText> </apex:column> <apex:column > <apex:outputLink value="http://maps.google.com/maps?f=d&source=s_d&saddr=&daddr={!acct.BillingStreet},{!acct.BillingCity},{!acct.BillingState},{!acct.BillingPostalCode}" target="_blank">Get Directions</apex:outputLink> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form>
Here's my controller class:
public with sharing class zipMap { public String zips { get; set; } public PageReference find() { return ApexPages.currentPage(); } public ApexPages.StandardSetController accts { get { if(accts == null) { List<String> zList = zips.split(','); accts = new ApexPages.StandardSetController( Database.getQueryLocator( [SELECT Id, Name, BillingStreet, BillingCity, BillingState, BillingPostalCode FROM Account WHERE BillingPostalCode IN : zList ORDER BY BillingPostalCode, Name] ) ); accts.setPageSize(10); } return accts; } set; } public List<Account> getAccounts() { return (List<Account>) accts.getRecords(); } public Boolean hasNext { get { return accts.getHasNext(); } set; } public Boolean hasPrevious { get { return accts.getHasPrevious(); } set; } public Integer pageNumber { get { return accts.getPageNumber(); } set; } public void first() { accts.first(); } public void last() { accts.last(); } public void previous() { accts.previous(); } public void next() { accts.next(); } }
Thanks in advance for your help.
Adriel