You need to sign in to do that
Don't have an account?
Vanitha Mani
How to handle lightning combobox
Hi i have a lightning combobox..I need help how to get the options from the query
Apex controller:
@AuraEnabled
public static List<SVC_Feature_Function__c> getRecords(String productId){
return [SELECT Id, Name FROM SVC_Feature_Function__c Where Product__c =:productId];
}
Component:
<aura:attribute name="statusOptions" type="List" default="[]"/>
<aura:attribute name="ticket" type="Object" access="private"/>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
fields="Id,Subject,CaseNumber,Information_Request_Type__c,Open_Tasks__c,RecordTypeId,Product_Build__c,System__c,Total_Work_Time__c,Flagged_for_KB_Review__c,Product__c,Feature_Function__c,Solution__c,SolvedBy__c,CauseCodeDetail__c,CauseCodeCategory__c,Billable__c,MajorIncident__c,Ready_to_Resolve_MI__c,Billing_Hours__c,Billing_Comments__c,Billing_Disposition__c"
targetFields="{!v.ticket}"
/>
<lightning:combobox aura:id="selectItem" name="Failure Point" label="Failure Point"
placeholder="Choose Failure Point"
value="new"
required="true"
dropdownAlignment="right"
variant="standard"
messageWhenValueMissing="You Must Select the Value"
onchange="{!c.handleOptionSelected}"
options="{!v.statusOptions}"/>
Js controller:
How to write js controller code to get the options and handle change when option selected to save to the ticket.
Apex controller:
@AuraEnabled
public static List<SVC_Feature_Function__c> getRecords(String productId){
return [SELECT Id, Name FROM SVC_Feature_Function__c Where Product__c =:productId];
}
Component:
<aura:attribute name="statusOptions" type="List" default="[]"/>
<aura:attribute name="ticket" type="Object" access="private"/>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
fields="Id,Subject,CaseNumber,Information_Request_Type__c,Open_Tasks__c,RecordTypeId,Product_Build__c,System__c,Total_Work_Time__c,Flagged_for_KB_Review__c,Product__c,Feature_Function__c,Solution__c,SolvedBy__c,CauseCodeDetail__c,CauseCodeCategory__c,Billable__c,MajorIncident__c,Ready_to_Resolve_MI__c,Billing_Hours__c,Billing_Comments__c,Billing_Disposition__c"
targetFields="{!v.ticket}"
/>
<lightning:combobox aura:id="selectItem" name="Failure Point" label="Failure Point"
placeholder="Choose Failure Point"
value="new"
required="true"
dropdownAlignment="right"
variant="standard"
messageWhenValueMissing="You Must Select the Value"
onchange="{!c.handleOptionSelected}"
options="{!v.statusOptions}"/>
Js controller:
How to write js controller code to get the options and handle change when option selected to save to the ticket.