function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Oleg NikitchukOleg Nikitchuk 

How to add 'All' option to combobox/

Hi all, 

I am not understanding why 'All' option is not appearning in my combobox dropdown list. It should be listed in here:User-added imagebut for some reason it's not there. 

HTML:
<template> <div class="slds-box slds-theme_default"> <div class="slds-text-color_inverse slds-text-heading_large" style="padding:0.5rem;background:#16325c"> Positions </div> <div style="width:200px; padding:0.5rem;"> <template if:true={statusPicklistValues.data}> <lightning-combobox name="filter" label="Status" value={selectedFilter} variant="label-hidden " options={statusPicklistValues.data.values} onchange={handleChange} placeholder="Select Status to filter"> </lightning-combobox> </template> </div> <table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_striped"> <thead> <tr class="slds-line-height_reset"> <th class="" scope="col">Position Name</th> <th class="" scope="col">Status</th> <th class="" scope="col">Opening Date</th> <th class="" scope="col">Closing Date</th> <th class="" scope="col">Minimum Salary</th> <th class="" scope="col">Maximum Salary</th> </tr> </thead> <tbody> <template if:true={positions}> <template for:each={positions} for:item="pos" for:index="index"> <tr key={pos.Id}> <td>{pos.Name}</td> <td>{pos.Status__c}</td> <!--<td> <template if:true={statusPicklist.data}> <lightning-combobox label="" value={pos.Status__c} options={PositionPicklist.data.values} onchange={handleChangeStatus} data-index={index}> </lightning-combobox> </template></td>--> <td>{pos.Opening_date__c}</td> <td>{pos.Closing_date__c}</td> <td>{pos.Salary_min__c}</td> <td>{pos.Salary_max__c}</td> </tr> </template> </template> </tbody> </table> </div> </template>

JS:
import { LightningElement, wire,track} from 'lwc'; import filterPositionsByStatus from '@salesforce/apex/positionStatusLwcController.filterPositionsByStatus'; import {getPicklistValues} from "lightning/uiObjectInfoApi"; import {getObjectInfo} from "lightning/uiObjectInfoApi"; import POSITION_OBJECT from "@salesforce/schema/Position__c"; import STATUS_FIELD from "@salesforce/schema/Position__c.Status__c"; export default class positionStatusLwc extends LightningElement { error; @track selectedFilter = 'All'; @track data = []; @track positions; @wire(getObjectInfo, {objectApiName: POSITION_OBJECT}) objectInfo; @wire(getPicklistValues, { recordTypeId: '$objectInfo.data.defaultRecordTypeId', fieldApiName: STATUS_FIELD}) statusPicklistValues; handleChange(event){ this.selectedFilter = event.detail.value; this.getFilteredPositions(); } connectedCallback() { this.getFilteredPositions(); } getFilteredPositions(){ filterPositionsByStatus({ selectedFilter: this.selectedFilter }) .then((data) => { if (data) { this.positions = data; } }) .catch((error) => { console.log(error); }); } }

Apex:
public with sharing class positionStatusLwcController { @AuraEnabled(Cacheable=false) public static List<Position__c> filterPositionsByStatus(String selectedFilter){ if (selectedFilter == 'All') { return [SELECT Name,Status__c,Opening_date__c,Closing_date__c,Salary_min__c,Salary_max__c FROM Position__c WHERE Status__c != NULL]; } else { return [SELECT Name,Status__c,Opening_date__c,Closing_date__c,Salary_min__c,Salary_max__c FROM Position__c WHERE Status__c = :selectedFilter]; } } }
asad khanna 8asad khanna 8
Method 1: Using Union Query
Step #1 Open Query Builder.
Step #2 Update Field/Column for combo box.
Step #3 Update to Union Query.
Step #4 Update the Combo Box (https://jannatasia.net/kids-clothes-wholesale/) Property.
Filter Data in Sub-Form by Using VBA for Combo box.
Example of Selecting “CA” on the Combo box state.
Example of Selecting <All> option.