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
shailendra singhaishailendra singhai 

<lightning:select drop down value binding

HI ,
Lightning related query; dropdown onchange;
I have custom object which is related to account. 
while keeping on component keeping as below
Featurename      Current status          Expected change dropdown
 ABC                    Active                Avalable option--> rectivate/inactive
XYZ                     inactive                   disable/Active

the vlues i am passing to component through handler class with wrapper
as below 

Feature name string/ Current status string/ expected change List<available option>

but while i select the dropdown value from the component , i am not getting that value in any attribute; and requirment is while select the dropdown it need to create string  and bind with feature name; 
note the feature name is around 15;
trying to use below code at component; 
<aura:iteration items="{!v.featureList}" var="featureObj">
                                        <tr>
                                            <td data-label="Features" >
                                            <div class="slds-truncate">{!featureObj.Feature}</div>
                                            </td>
                                            <td data-label="Status" >
                                            <div class="slds-truncate">{!featureObj.Status}</div>
                                            </td>
                                            <td data-label="Action" >
                                               <lightning:select class="dynamic" aura:id="ActionSelectDynamic"  >
                                                   <option value="">-- Select -- </option>
                                                    <aura:iteration items="{!featureObj.Action}" var="action">
                                                        <option value="{!action}" label="{!action}" title="{!action}" />
                                                        
                                                      </aura:iteration>
                                                </lightning:select>
 


 
Kumar, GajendraKumar, Gajendra
Hi Shailendra,

Try it the following way.:

<lightning:select class="dynamic" aura:id="ActionSelectDynamic" value="{!v.selectedValue}  >
                        <option value="">-- Select -- </option>
                    <aura:iteration items="{!featureObj.Action}" var="action">
                    <option value="{!action}" label="{!action}" title="{!action}" text="{!action}"></option> 
                    </aura:Iteration>
             </lightning:select>

Attribute "selectedValue" will hold the selected value which you can then use in your controller.

Regards,
Gajendra

If this answer solves your problem, please mark it as best answer