简体   繁体   中英

How to filter a picklist based on the selected value of some other picklist in salesforce

我正在创建一个集成了salesforce SDK的android应用,在salesforce自定义对象中,我有两个选择列表(category__c和sub_category__c),如何根据 salesforce 中类别 _c 的选定值过滤sub_category_ c

Make onchange event for category__c picklist which will filter by criteria sub_category__c.

<apex:inputField value="{!category__c}" >
   <apex:actionSupport event="onchange" rerender="subCat">
</apex:inputField>
<apex:selectList value="sub_category__c" id="subCat">
    <apex:selectOptions value="{!filteredSubCategories}" />
</apex:selectList>

Where on controller

 public void getFilteredSubCategories(){
      public List<SelectOption>  result = new List<SelectOption>();
      for(SelectOption so : allSubCategories){ // dont forget to init allSubCategories in constructor
          if(someCriteriaMet) { // add logic
              result.add(so)    
          }
      }
      return result;
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM