I have a Lightning Component that deletes a record.
Currently its simply a html Button onclick, which calls a function in the Client Side Controller, which calls a helper function:
cmp:
<button type="button" onclick="{!c.deleteRec}">Delete</button>
controller:
deleteRec: function(component, event, helper) {
helper.deleteRec(component, event, helper);}
I would like to use Sweetalert for the confirmation. I cant figure out how to take the confirmation, and then call the deleteRec function. Does anyone have a simple example?
Best Answer
Here is a working example of code in my dev org:
Prerequisite:
sweetalert2
.HelloWorldApp.app
HelloWorldAppController.js:
Output: https://imgur.com/a/DQDY9
EDIT:
To retrieve attribute of the button in controller code, make the below changes:
Component markup:
Controller code: