Skip to content

Instantly share code, notes, and snippets.

@dancinllama
Created September 6, 2012 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dancinllama/3659538 to your computer and use it in GitHub Desktop.
Save dancinllama/3659538 to your computer and use it in GitHub Desktop.
//Apex Controller code
public List<SelectOption> filterCriteria{
get{
//TODO change the names to labels
List<SelectOption> options = new List<SelectOption>();
for(Account a : [Select Name,Value__c From Account Limit 10]){
options.add(new SelectOption(a.Value__c,a.Name);
}
return options;
}
}
<!-- VF code -->
<!-- Controller has filter string member variable which this select list assigns the selected value to… -->
<apex:selectList value="{!filter}" size="1">
<apex:selectOptions value="{!filterCriteria}" />
<apex:actionSupport event="onchange" action="{!filterAccounts}" rerender="id1,id2"/>
</apex:selectList>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment