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
SARI4SARI4 

Button should be disable until page fully get loaded in lightning component

I have a lightning App, there is lightning button, which is conditonally enable or disable. 
When it should be in disable state and i refresh the page then UNTIL page fully get loaded the button show as enabled, which allow to click on the button to perform next step. How I can avoid this situation 
Navin Selvaraj23Navin Selvaraj23
Hi SARI4,

In Aura Component, declare one attribute like below.
 
<aura:attribute name="isButtonDisabled" type="Boolean" default="true"/>

Then, have your lightning button like below:
<lightning:button variant="brand"   disabled="{!v.isButtonDisabled}">Disabled Brand</lightning:button>

In default, the button will be disabled. So, you cannot perform the click opeation.
Once the complete data for you is returned, then you can set this variable as true from client side controller or helper like as follows.
component.set("v.isButtonDisabled",false);

Hope it helps you. If it helps, mark it as your best answer, else please comment below with more detail. we can discuss.


Best Regards,
Navin S