depending on if you use data grid or data grid 2 it could be slightly different but both have the option of a single-select or multi-select. The old data grid even has the delete option by default (only visible/usable with correct entity access).
If you add a button to the data grid calling a microflow you will have a object or list (single/multi-select) parameter in the microflow available (which reflects your selection).
You can then just delete the input object(s). Make sure to have the microflow access configured (otherwise the button won’t be visible) and maybe add a confirmation (to make sure users don’t delete by accident).
E.g. with DataGrid2:
Ensure you have a data grid widget in your Mendix application that displays the data you want to delete, bound to a specific entity in your domain model.
Create a new microflow named "DeleteSelectedItems."
In the microflow, add a parameter of the entity type corresponding to the data displayed in your data grid. This parameter will receive the selected items for deletion.
Inside the microflow, add a loop (e.g., "For Each" activity) to iterate over the selected items you want to delete.
Within the loop, use the "Delete" activity to delete each selected entity.
In your data grid, create a "Delete" button (or another button as desired). Configure the button to trigger the "DeleteSelectedItems" microflow and pass the selected items as a parameter.