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

How do I get a selectList in my VF page for a custom case controller to work?
I have a VisualForce page that uses a custom controller. This is my controller:
global class CompanyCasesQuery {
//constructors and variable declaration
global List<Case> results {
get {
//returns a list of cases
return results;
}
set;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('00BW0000000PeSVMA0','View All Open Cases'));
options.add(new SelectOption('00BW0000000PbzWMAS','View All Cases'));
options.add(new SelectOption('00BW0000000PeSGMA0','View All Closed Cases'));
options.add(new SelectOption('00B300000005XQtEAM','Recently Viewed Cases'));
return options;
}
public String[] getFilterId() {
return filterid;
}
public void setFilterId(String[] filterid) {
this.filterid = filterid;
}
}
This is my VisualForce page:
<apex:page controller="CompanyCasesQuery" sidebar="true" showHeader="true"> <apex:form > <apex:pageBlock title="My Cases"> <apex:outputLabel value="View:"/> <apex:selectList value="{!filterId}" size="1"> <apex:actionSupport event="onchange" action="{!results}" rerender="cases_table"/> <apex:selectOptions value="{!items}"/> </apex:selectList> <apex:pageBlock > <apex:pageBlockTable value="{!results}" var="c" rows="50" id="cases_table" > <apex:column > <a target="_parent" href="/{!c.id}">{!c.CaseNumber}</a> <apex:facet name="header">Case Number</apex:facet> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:pageBlock> </apex:form> </apex:page>
The cases show up correctly and the select list shows up correctly. However, when I select an option in my select list, nothing happens. What I would like to have happen is when I select an option in the select list, my cases refresh like the default Salesforce cases page. When I select "View All Cases", all cases are displayed, when I select "View All Closed Cases", only closed cases are displayed. How do I get this select list refresh to work? Thanks.
Please mark as closed when done
All Answers
This is my VisualForce page:
I just tried this and and I get an empty list of cases.
Well Works for me. :)
https://c.ap1.visual.force.com/apex/CaseSearch
Please mark as closed when done
It works for me now. It was the select options that I had wrong. Thanks a lot!