You need to sign in to do that
Don't have an account?
Heather_Hanson
On change event filter not working
I'm not sure what I'm missing so that when the onchange event happens on the picklist values, my searchResults is not updating to show only the records with that value.
Right now, when I select a different product family from the list, nothing happens to the products displayed.
Any help would be apprecidated!!
Here is my visualforce page section:
Here is the update available list function:
This is how I'm getting my product family list:
Right now, when I select a different product family from the list, nothing happens to the products displayed.
Any help would be apprecidated!!
Here is my visualforce page section:
<apex:selectList value="{!products.Family}" size="1" id="Families"> <apex:actionSupport event="onchange" action="{!updateAvailableList}" reRender="searchResults" /> <apex:selectOptions value="{!Families}"/> </apex:selectList>
Here is the update available list function:
public void updateAvailableList() { String qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Pricebook2Id = \'' + theBook.Id + '\''; if(searchString!=null){ qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.ProductCode like \'%' + searchString + '%\')'; }
This is how I'm getting my product family list:
public List<SelectOption> getFamilies() { List<SelectOption> options = new List<SelectOption>(); Schema.DescribeFieldResult fieldResult = Product2.Family.getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry f : ple) { options.add(new SelectOption(f.getLabel(), f.getValue())); } return options; }
This might be an issue on VF Page code but couldn't confirm without seeing your full VF Page code. Please post your full VF Page if the below solution didnt work.
I have encountered this issue in the past and I remember solving it by adding an extra apex:outputPanel with an id which wraps the results table. Then calling this outputpanel Id in rerender.
Example:
<apex:page controller="sampleCon">
<apex:form>
<apex:selectList value="{!countries}" multiselect="true">
<apex:selectOptions value="{!items}"/>
</apex:selectList><p/>
<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
<apex:outputPanel id="out"> <----- Extra Outputpanel that wraps around the results table
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
<apex:outputPanel> <--- Results section
<p>You have selected:</p>
<apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:form>
</apex:page>
Thanks for responding! I have the outputPanel with ID already. Here is my full Visualforce: