HI all,
What seems to be the problem:
Building a site with search/filter/bulk actions as per the Surge Demo App/Tutorials, but when filtering with a search then choosing a bulk action - export to csv or delete selected - the action ignores the item id checkbox values and simply exports, or more worryingly deletes all items in results array - not in checked values array. Even if no checkboxes are checked all filtered results are actioned.
Steps to Reproduce:
In Surge style app go to model dashboard, filter with the search input, get results, then choose bulk actions -> export selected or delete selected. at that point, even with no checkboxes selected, it deletes all records on the results view, or exports. If one or more checkboxes are checked it ignores that the same way and exports/deletes all.
Are you using the latest version of Livewire:
Livewire version: 2.3.5 -
Laravel Framework 8.18.1 -
Alpine version: 2.5.0 -
Browser: Chrome 87.0.4280.88, Safari 14.0.2
Do you have any screenshots or code examples:
bulk action delete in blade:
<x-dropdown.item type=“button” wire:click="$toggle(‘showDeleteModal’)" class=“flex items-center space-x-2”>
<x-icon.trash class=“text-cool-gray-400”/> Delete
</x-dropdown.item>
checkboxes for bulk select
<x-input.checkbox wire:model=“selected” value="{{ $FileItem->id }}"></x-input.checkbox>
bulk delete in controller::
public function deleteSelected()
{
$deleteCount = $this->selectedRowsQuery->count();
$this->selectedRowsQuery->delete();
$this->showDeleteModal = false;
$this->notify('You\'ve deleted '.$deleteCount.' items');
}
thanks folks
G