Deleting a Contact
Explore how to implement contact deletion in Marionette.js by adding a delete button with event handling. Learn to manage event bubbling, use specific CSS selectors for event listeners, and delegate data modification tasks properly to maintain clean application architecture.
Our goal is to enable the functionality of deleting a contact in our application. For that, we need to follow the steps provided in the figure below:
Add the “Delete” button
Now that we’ve got our contacts listed as we want them, let’s add a button to delete a contact:
Lines 5–8: Generate a
“Delete”button styled with Bootstrap.Line 6: Add an icon to the button.
Add a column to the template
Since we’ve added a column to our child view, let’s keep things in sync by adding a column to the table template in line 6:
If we look at our page, we’ll see our “Delete” ...