0

I have tried several methods already but this still wont work. It defaults to the first option in the list.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_select.htm

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_ui_inputSelect.htm

currently, here's what I have

<ui:inputSelect class="slds-input slds-text-align-center" value="{! taskRec.status}">
    <aura:iteration items="{! v.status }" var="status" >
    <ui:inputSelectOption text="{! status }"/>
    </aura:iteration>
</ui:inputSelect>

taskRec.status - is being iterated as well. i displayed this in plain text and it returns the proper value I just really need to set the same in the select option

2

From the documentation of the ui:inputSelectOption:

value : Boolean Indicates whether the status of the option is selected. Default value is “false”.

Then, you can use:

<ui:inputSelect class="slds-input slds-text-align-center">
    <aura:iteration items="{! v.status }" var="status" >
    <ui:inputSelectOption text="{! status }" value="{!status == taskRec.status}"/>
    </aura:iteration>
</ui:inputSelect>
0

I came across the exact scenario. Please create a string attribute and assign the value of taskrec.status to that string attribute in your doinit and when picklist value is changed you can call on change to set taskrec.status or pass this string value to apex and set it there.

Please let me know if this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.