0

how to pass the index values from lightning:select to javascript onchange event occurs. please help anyone

                                <td>
                                    <!--lightning:input variant="label-hidden" class="slds-align_absolute-center" disabled="true" name="Name" type="text"    value="{!set.field}" /-->
                                    <a style="color:black"   >
                                        <!--lightning:combobox aura:id="select_Field" name="FieldReference" label="FieldReference" placeholder="Choose any Field" variant="label-hidden" value="{!set.field}" options="{! v.headerOptions }" /-->
                                        <lightning:select   class="label-hidden" value="{!set.field}" data-id="{!masterindex}" data-value="{!childindex}" onchange="{!c.onHeaderChange}" >
                                             <option text="Select any value" value=""/>
                                            <aura:iteration items="{!v.headerOptions}" var="Option">
                                                <option text="{!Option.label}" value="{!Option.value}"/>
                                            </aura:iteration>
                                        </lightning:select>

                                    </a>
                                </td>
1
  • you mean selected value? if yes you want get option.label or Option.value?
    – sdandamud1
    Dec 5, 2019 at 13:13

1 Answer 1

0

use the option of selectedValue for lightning select.

  <lightning:select name="colorId" label="Select a color:" aura:id="colorId" value="{!v.selectedValue}">
        <aura:iteration items="{!v.options}" var="option">
            <option text="{!option.label}" value="{!option.id}" selected="{!option.selected}"/>
        </aura:iteration>
    </lightning:select>

the selectedValue holds the value selected from lightning select.

1
  • In the method, onHeaderChange, call the selected value using, component.get('v.selectedValue');
    – Ankur ---
    Dec 5, 2019 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .