-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
0Replies
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
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
- Avik Mukherjee 16
- November 28, 2019
- Like
- 0
- Continue reading or reply
I am getting error when ever i am trying to update a object in an object array in LWC
When ever i am trying to update a value in the object array i am greeting script error, even splice does not works below are two snippets in lwc js.
let allValues=this.budgetData; // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues) ); for(let i = 0; i < allValues.length; i++){ if(allValues[i].Id === event.target.name ){ // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues[i]) ); allValues.splice(i,1); } }
let allValues=this.budgetData; // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues) ); for(let i = 0; i < allValues.length; i++){ if(allValues[i].Id === event.target.name ){ // eslint-disable-next-line no-console console.log('allValues ' + JSON.stringify(allValues[i]) ); allValues[i]= objectvalue; } }
- Avik Mukherjee 16
- November 27, 2019
- Like
- 0
- Continue reading or reply
Update Table values based on user Inputs in LWC
Hello Everyone,
I need your help, I am trying to fetch data from a apex class and store it in a list. The list basically has a custom object data. now when i render it in a table and show in the html , i display the values in a table and use input fields to show. Now when i change the values from the front end it does not stores in the track variable. I know there should be some java script magic, can you help to figure out what ?
HTML:
<template for:each={budgetData} for:item="budget">
<tr key={budget.Id} class="slds-hint-parent">
<td >
<div class=" headingBG" >{budget.BG_Code__c}</div>
</td>
<td >
<div class=" headingBG" >{budget.BG_Name__c}</div>
</td>
<td >
<div class=" headingBG" >{budget.Category_Code__c}</div>
</td>
<td >
<div class=" headingBG" >{budget.Category_Name__c}</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" id={budget.Id} name={budget.Upselling_Investment__c} value={budget.Upselling_Investment__c} disabled={disableFieldBudget} onchange={onchangevalues} >
</lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Retailer_promotion_STTI__c} disabled= {disableFieldBudget} ></lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Consumer_promotion__c} disabled={disableFieldBudget} ></lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Brand_investment__c} disabled={disableFieldBudget} ></lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Cooperative_advertising_KAM__c} disabled={disableFieldBudget} ></lightning-input>
</div>
</td>
So when the value which comes is a list and i store it in a track. Now when i want to update i should call a onchange method may be.
I need your help, I am trying to fetch data from a apex class and store it in a list. The list basically has a custom object data. now when i render it in a table and show in the html , i display the values in a table and use input fields to show. Now when i change the values from the front end it does not stores in the track variable. I know there should be some java script magic, can you help to figure out what ?
HTML:
<template for:each={budgetData} for:item="budget">
<tr key={budget.Id} class="slds-hint-parent">
<td >
<div class=" headingBG" >{budget.BG_Code__c}</div>
</td>
<td >
<div class=" headingBG" >{budget.BG_Name__c}</div>
</td>
<td >
<div class=" headingBG" >{budget.Category_Code__c}</div>
</td>
<td >
<div class=" headingBG" >{budget.Category_Name__c}</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" id={budget.Id} name={budget.Upselling_Investment__c} value={budget.Upselling_Investment__c} disabled={disableFieldBudget} onchange={onchangevalues} >
</lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Retailer_promotion_STTI__c} disabled= {disableFieldBudget} ></lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Consumer_promotion__c} disabled={disableFieldBudget} ></lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Brand_investment__c} disabled={disableFieldBudget} ></lightning-input>
</div>
</td>
<td >
<div class="slds-truncate" >
<lightning-input type="text" value={budget.Cooperative_advertising_KAM__c} disabled={disableFieldBudget} ></lightning-input>
</div>
</td>
So when the value which comes is a list and i store it in a track. Now when i want to update i should call a onchange method may be.
- Avik Mukherjee 16
- November 26, 2019
- Like
- 0
- Continue reading or reply
Redirect to a different url if the user is partner.
Hi All,
I have a requirement where if the user is a partner user then on button click it should redirect to different url and for internal users a different url.
{!
IF( $User.License_Type__c =='Gold Partner',
/philipspartnercommunity/setup/ui/recordtypeselect.jsp?ent=Opportunity&retURL=%2Fphilipspartnercommunity%2F001d000001y1zTy&save_new_url=%2Fphilipspartnercommunity%2F006%2Fe%3FretURL%3D%252Fphilipspartnercommunity%252F001d000001y1zTy%26accid%3D001d000001y1zTy ,
/setup/ui/recordtypeselect.jsp?ent=Opportunity&retURL=%2F{!Account.Id}&save_new_url=%2F006%2Fe%3FretURL%3D%252F{!Account.Id}%26accid%3D{!Account.Id}
&00Nd00000076VtL="{!Account.Market__c}"
)}
but this does not work,can any one help.
I have a requirement where if the user is a partner user then on button click it should redirect to different url and for internal users a different url.
{!
IF( $User.License_Type__c =='Gold Partner',
/philipspartnercommunity/setup/ui/recordtypeselect.jsp?ent=Opportunity&retURL=%2Fphilipspartnercommunity%2F001d000001y1zTy&save_new_url=%2Fphilipspartnercommunity%2F006%2Fe%3FretURL%3D%252Fphilipspartnercommunity%252F001d000001y1zTy%26accid%3D001d000001y1zTy ,
/setup/ui/recordtypeselect.jsp?ent=Opportunity&retURL=%2F{!Account.Id}&save_new_url=%2F006%2Fe%3FretURL%3D%252F{!Account.Id}%26accid%3D{!Account.Id}
&00Nd00000076VtL="{!Account.Market__c}"
)}
but this does not work,can any one help.
- Avik Mukherjee 16
- November 09, 2016
- Like
- 0
- Continue reading or reply