Skip to content

comboboxify

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']
})
: [];
}
}
NameTypeDescription
dataObject[]Array of javascript objects received from any sources
shapeOptionShapeDescription of how you want your options to look like by defining the props label, value and description
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];
}
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];
}
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'};
}