Deleting table row(s)
- Import delete confirm modal
{{ template "delete-confirm-modal" . }}to the page with the table. Modal can be custom, but there is few requirements that should be implemented: Modal confirm button must submit the form with method POST. Submitted form should include inputs:<input type="hidden" name="postAction" value="delete">, value delete may be set dynamically using JS, or statically like in sample if related form used only for the delete action<input type="hidden" name="postActionEntity" value="ModelDtoList">, where value is the entity name which table is related to. Usually ends withList<input type="hidden" name="postActionIds" value="1,2,3">, where value is the ids of each entity separated by comma. If only one id, then just a number, like value=“1”
- There is also a default delete confirmation modal that can be used during custom template creation. Use the statement from option 1 to import it. Here is a sample how to use it:
Note
Ids and names for inputs should be the same as in sample. Values are optional. The button should have data-form-id set to the related form id, data-post-action-entity should have the name of the entity that is related to the table. Button should have class form-delete-button.