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.
rerender
attribute? Also, is it possible that the page is refreshing, but the underlying data in theresults
variable has not changed? One way to tell that would be to echo{!FilterId}
in thecase_table
and see if that changes.results
variable. Is there anything that happens during the results get?