How to add Delete Functionality Inside a Modal
Here’s a way to add the delete functionality inside an edit popup modal.
Step 1
Create a table with an “Edit” link.
Step 2
Add a custom component to the edit page.
Step 3
Add custom code to the template and JavaScript.
Template
{{#each records}}
</br>
<p style="display:none;" id="id">{{id}}</p>
<button class="btn btn-danger pull-left" id="delete"> Delete Record </button>
{{/each}}
JavaScript
document.getElementById("delete").onclick = async function() {
if (confirm("Are you sure you want to delete this session")) {
var i = document.getElementById("id").innerText
await deleteRecord("4YZjnDNPvl", i); // In this part add your delete function
location.reload();
}
};