You need to sign in to do that
Don't have an account?

Conditional attribute default value
Hello,
I have a modal that is displayed via two separate buttons - the component contains an attribute that determines which button opened the modal (via an event being fired) and an attribute containing the value of a picklist. I want the picklist to default to an option when one button is pressed, and not default to an option when the second button is pressed (remain blank until the user changes it).
How can I accomplish this while still only using this one comonent? I tried declaring the attributes in an aura:if tag that checks which button opened the modal, but it wouldn't compile.
I have a modal that is displayed via two separate buttons - the component contains an attribute that determines which button opened the modal (via an event being fired) and an attribute containing the value of a picklist. I want the picklist to default to an option when one button is pressed, and not default to an option when the second button is pressed (remain blank until the user changes it).
How can I accomplish this while still only using this one comonent? I tried declaring the attributes in an aura:if tag that checks which button opened the modal, but it wouldn't compile.
Could you paste your code / markup?
If I'm understanding correctly, you'd just use an aura:attribute (of type string), name it something like defaultPicklistValue, and then pump that right into your picklist. Then when you call the component, you'd either pass in blank or the default attribute