I have a list of records displayed on lightning component using
There are Save buttons corresponding to each record. The fields of the records are editable. I want to save the record, the corresponding button of which has been clicked. Other records will not be saved. I would like to understand, how to save this particular record. I am very new to lightning and any sample code would be really helpful.
Best Answer
What you're looking for is very similar to the app project on Salesforce TrailHead - Build a Lightning App with the Lightning Design System
The idea is to split the task into two components: - List - will hold the list of records - Editor - will hold data about specific record and allow you to save it
The following is general approach:
List
would get list of records from Apex controller oninit
even handlerList
would iterate over the list of records and displayEditor
component for each recordEditor
would have a form with a save buttonEditor
form would call Apex controller to save data