Bulk Actions
Select multiple rows with checkboxes, then Bulk Edit or Bulk Delete them all in a single request.
Enabling it
bulk_actions($enabled = true) adds a checkbox column - leftmost, before every other column - letting the visitor select multiple rows across the current page. A "select all" checkbox in the header selects/clears every row on the current page. Selection isn't cleared by a page/search/sort change, so it persists across several pages too, until explicitly cleared:
$xcrud->table('products');
$xcrud->columns('productCode,productName,productLine,quantityInStock,buyPrice');
$xcrud->bulk_actions();
As soon as anything is selected, a bar appears showing how many rows are selected, plus Bulk Edit and Bulk Delete buttons.
Bulk Delete
Removes every selected row in one request (DELETE ?ids=1,2,3 against ajax_crud.php - a single WHERE pk IN (...) query, not N separate requests), behind the same ->remove_confirm() confirmation a single delete already uses.
Bulk Edit
Opens a form listing every editable field, each with its own "apply this field" checkbox next to a normal type-aware control - unchecked (and its control disabled) by default, so nothing is touched unless it's explicitly opted in. Only the fields checked are sent, applied to every selected row in one request (PUT ?ids=1,2,3). There's no single "current value" to show when multiple rows are involved, so every control starts blank/default rather than pre-filled from any one row.
->pass_var() still applies to both Bulk Edit and Bulk Delete, enforced server-side exactly like a single create/update.
Options table
| Call | Effect |
|---|---|
bulk_actions() | Enables the checkbox column, select-all, and the Bulk Edit/Bulk Delete toolbar. Off by default. |
bulk_actions(false) | Explicitly disables it. |