Skip to content

Commit

Permalink
Fix select-all checkbox to respect delay setting
Browse files Browse the repository at this point in the history
  • Loading branch information
matberry committed Dec 9, 2024
1 parent a28d2d8 commit 3827c62
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
18 changes: 4 additions & 14 deletions resources/js/partials/tableWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ function tableWrapper() {
this.clearSelected();
this.selectAllStatus = false;
} else {
if (this.delaySelectAll)
{
this.setAllItemsSelected();
}
else
{
this.setAllSelected();
}
this.setAllSelected();
}
},
setAllItemsSelected() {
Expand All @@ -42,13 +35,10 @@ function tableWrapper() {
if (!showBulkActionsAlpine) {
return;
}
if (this.delaySelectAll)
{
if (this.delaySelectAll) {
this.selectAllStatus = true;
this.selectAllOnPage();
}
else
{
} else {
wire.setAllSelected();
}
},
Expand Down Expand Up @@ -79,4 +69,4 @@ function tableWrapper() {
}));
}

export default tableWrapper;
export default tableWrapper;
2 changes: 1 addition & 1 deletion resources/js/partials/tableWrapper.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions resources/views/components/table/th/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@
>
<input
x-init="$watch('indeterminateCheckbox', value => $el.indeterminate = value); $watch('selectedItems', value => newSelectCount = value.length);"
x-on:click="if(selectedItems.length == paginationTotalItemCount) { $el.indeterminate = false; $wire.clearSelected(); bulkActionHeaderChecked = false; } else { bulkActionHeaderChecked = true; $el.indeterminate = false; $wire.setAllSelected(); }"
x-on:click="if(selectAllStatus || selectedItems.length == paginationTotalItemCount) {
$el.indeterminate = false;
$wire.clearSelected();
bulkActionHeaderChecked = false;
} else {
bulkActionHeaderChecked = true;
$el.indeterminate = false;
setAllSelected();
}"
type="checkbox"
:checked="selectedItems.length == paginationTotalItemCount"
:checked="selectAllStatus || selectedItems.length == paginationTotalItemCount"
{{
$attributes->merge($bulkActionsThCheckboxAttributes)->class([
'rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150 ease-in-out focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-900 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600 dark:focus:bg-gray-600' => ($theme === 'tailwind') && ($bulkActionsThCheckboxAttributes['default'] ?? true),
Expand Down

0 comments on commit 3827c62

Please sign in to comment.