0

I have some attributes in a lightning component where i use them in order to change dynamically the screen in some aura: if. i observe a very strange behavior, especially when we have more than 2 attributes in a condition... To be more specific, i make some fields in a recordEdit form of Account disabled based on this condition

disabled="{!(v.noCustomerTypePermission || (v.cleansed && !v.overrideCleansing))}"

On init, it works fine.. When i click a button which changes the value of v.cleansed attribute to true, again it works fine... However, when i click a button which changes the value of the same attribute back to false, this condition

 "{!(v.noCustomerTypePermission || (v.cleansed && !v.overrideCleansing))}"

still keeps value to true.... Also, i use this code in footer to show appropriate buttons:

<div class="slds-modal__footer">
    <aura:if  isTrue="{!not(v.cleansed)}" >
        <!-- 05/09/2019 George Galaios: Button that cancels the dialog -->                
        <lightning:button variant="neutral" label="{!$Label.c.ea_Cancel}" onclick="{!c.cancelDialog}"/>
        <!-- 05/09/2019 George Galaios: Button that calls cleanseRecord controller function-->
        <lightning:button variant="brand" label="{!$Label.c.ea_Save}" onclick="{!c.cleanseRecord}" />
    </aura:if>
    <aura:if  isTrue="{!v.cleansed}" >
        <lightning:button variant="neutral" label="Back" onclick="{!c.handleBack}" />
        <lightning:button variant="brand" label="{!$Label.c.ea_Confirm}" onclick="{!c.saveRecord}" />
    </aura:if> 
</div>

on init again it works fine, also if i click on save button which makes the Attribute v.cleansed to true it works fine showing me the other 2 buttons. But, when i click back button which changes value of attribute v.cleansed back to false, then all buttons are disappeared from the footer, meaning both conditions are false.... But the one condition is the opposite of the other so how can this occur?!

  • can you also share controller for this – Kushal Chauhan Nov 16 at 17:44

Your Answer

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

Browse other questions tagged or ask your own question.