• Saransh Srivastava
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies
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.

 
Hi All,

Add/Remove Records using LWC.

If any one want to create Add/Remove multiple records in lightning web component dynamically then please refer this post. 

Features:
1. Add rows using plus( + ) button.
2. Dynamic Add/Remove record row.
3. Proper Serial Number in table. For each index starts from 1.
4. Clear All Feature.
5. Save button label change button.
6. Toast Message after record succesfully inserted.

Refer the code in below post...

Like this Post if it's helps to any one !!!

Thanks,
Maharajan.C