I want to add column to delete record from the list. It looks below but i got error message:
Items not selected for deletion
<button type="button"
class="btn btn-primary btn-xs"
data-request="onDelete"
data-load-indicator="Deleteing..."
data-request-data="record: <?=$record->id?>"
data-request-confirm="Are you sure?">
Usuń
</button>
apinard
#2
Hi @mkinternet,
The issue occurs because it looks like you’re using the default onDelete
handler, which expects an array in $_POST['checked']
.
To resolve this, you should update the button like this:
<button
type="button"
class="btn btn-primary btn-xs"
data-request="onDelete"
data-load-indicator="Deleteing..."
data-request-data="{'checked': [<?=$record->id?>]}"
data-request-confirm="Are you sure?">
Usuń
</button>
Also, don’t forget to set “clickable: false” in your column definition to prevent the record from opening when clicked.
2 Likes