-1

I am using a lightning component that is displayed in account's page layout. Basically the component shows list of related records with functionality to edit and delete. This is how it looks enter image description here

On clicking on edit I update the post code value and click on close without saving. Ideally the component should show the value which is there in the DB, not what is edited temperorily.

enter image description here enter image description here

The actual value of post code is 481 but the value shown is 48 Does that mean I should use LDS only when single screen is involved in a transaction not like mine where I have 2 screens one for showing records with field value and one for modal dialogue to perform dml. If I still go ahead with Lds only I believe I need to use event firing so that the back screen behind the modal dialogue can be refreshed as the modal dialogue closes on clicking save or cancel. Please let me know the better approach and in case something wrong in my undersanding

1 Answer 1

2

LDS do provide an ability to reload the record. In your case if user clicks on "Cancel" you can easily reload the record from database.

component.find("forceRecord").reloadRecord();

Here's the link to documentation LDS Record Changes

No need to call a separate event

1
  • Not sure what you mean by "Single Screen Transaction", but you can look at it like "StandardController" in traditional VF pages. If you want to perform Create, Update, Delete operation to single object then LDS is the answer. For more complex scenarios where you want to pull the data from different objects and process them on screen, you can think of writing your own custom components (again, something similar to deciding on using extensions or custom controllers in VF). There are few great posts on LDS which you can read and get more insights.
    – MandyKool
    Jul 1, 2018 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.