comboboxify
Import
Section titled “Import” import { comboboxify } from 'c/boltage';export default class myLwc extends LightningElement { @wire(apexMethod) apexResults; get comboboxOptions() { return this.apexResults?.data ? comboboxify(this.apexResults.data, { value: ['Relation__c.Field__c'], label: ['Relation__c.Field__c'] }) : []; } }Methods
Section titled “Methods”comboboxify(data, shape) : Option[]
Section titled “comboboxify(data, shape) : Option[]”| Name | Type | Description |
|---|---|---|
data | Object[] | Array of javascript objects received from any sources |
shape | OptionShape | Description of how you want your options to look like by defining the props label, value and description |
Example
Section titled “Example”Usage of relationship field
Section titled “Usage of relationship field”export default class myLwc extends LightningElement { @wire(apexMethod) apexResults; get comboboxOptions() { return this.apexResults?.data ? comboboxify(this.apexResults.data, { value: ['Relation__c.Field__c'], label: ['Relation__c.Field__c'] }) : []; } }@auraEnabled(cacheable=true)public static Case apexMethod() { return [SELECT Relation__c.Field__c FROM Case];}Concatenate values
Section titled “Concatenate values”export default class myLwc extends LightningElement { @wire(apexMethod) apexResults; get comboboxOptions() { return this.apexResults?.data ? comboboxify(this.apexResults.data, { value: ['Relation__c.Field__c', 'OtherField__c', 'AnotherOne__c'], label: ['Relation__c.Field__c'] }) : []; } }@auraEnabled(cacheable=true)public static Case apexMethod() { return [SELECT Relation__c.Field__c, OtherField__c, AnotherOne__c FROM Case];}Usage of single values
Section titled “Usage of single values”export default class myLwc extends LightningElement { @wire(apexMethod) apexResults; get comboboxOptions() { return this.apexResults?.data ? comboboxify(this.apexResults.data, { value: ['$'], label: ['$'] }) : []; } }@auraEnabled(cacheable=true)public static String apexMethod() { return new Array<String>{'OK', 'KO', 'ERROR', 'WARN'};}