+ Start a Discussion
Avik Mukherjee 16Avik Mukherjee 16 

Disable/Enable Input Text conditionally in LWC

I am building a table in LWC and the table iterates on a list coming from apex. There is a custom object called Budget AOP which i query and put the data in a list and iterate it to bring a table. Now while i bring this from Apex i have to also bring the total values, which is summing up the number fields and showing a total value.
Problem- I have a edit button, on click of which i enable/disable the input text fields so that user can put the new value and i have a save button on click of which i call apex and save the data. Problem comes when user also gets a enable text field for Total value.
What i want is i don't want the Total value rows to be enabled even if user clicks on edit button . But this value is also coming from the list which i am iterating in the for loop.

<lightning-input type="text" id= {budget.Id} onchange={onchangevalues} name="upselling" value={budget.Upselling_Investment__c} disabled={disableFieldBudget} > </lightning-input> </div>

On click of edit i simply make disableFieldBudget= false, but then also the total value rows becomes enabled in that case. Any Suggestion