Skip to content

Commit

Permalink
Merge pull request #12853 from dev-idkwhoami/fix/select-current-page-…
Browse files Browse the repository at this point in the history
…only-select-all-link-behavior

Fix: Incorrectly hiding the 'Select all X' table link
  • Loading branch information
danharrin authored May 20, 2024
2 parents 7db11d8 + 221ea5b commit 29add93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
'allSelectableRecordsCount',
'deselectAllRecordsAction' => 'deselectAllRecords',
'end' => null,
'page' => null,
'selectAllRecordsAction' => 'selectAllRecords',
'selectCurrentPageOnly' => false,
'selectedRecordsCount',
'selectedRecordsPropertyName' => 'selectedRecords',
])
Expand Down Expand Up @@ -41,10 +43,11 @@ class="text-sm font-medium leading-6 text-gray-700 dark:text-gray-200"
<div class="flex gap-x-3">
<x-filament::link
color="primary"
:id="$this->getId() . '.table.selection.indicator.record-count.' . $allSelectableRecordsCount"
tag="button"
:x-on:click="$selectAllRecordsAction"
:x-show="$allSelectableRecordsCount . ' !== ' . $selectedRecordsPropertyName . '.length'"
:x-show="$selectCurrentPageOnly ? '! areRecordsSelected(getRecordsOnPage())' : $allSelectableRecordsCount . ' !== ' . $selectedRecordsPropertyName . '.length'"
{{-- Make sure the Alpine attributes get re-evaluated after a Livewire request: --}}
:wire:key="$this->getId() . 'table.selection.indicator.actions.select-all.' . $allSelectableRecordsCount . '.' . $page"
>
{{ trans_choice('filament-tables::table.selection_indicator.actions.select_all.label', $allSelectableRecordsCount) }}
</x-filament::link>
Expand Down
3 changes: 3 additions & 0 deletions packages/tables/resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
$isGlobalSearchVisible = $isSearchable();
$isSearchOnBlur = $isSearchOnBlur();
$isSelectionEnabled = $isSelectionEnabled() && (! $isGroupsOnly);
$selectsCurrentPageOnly = $selectsCurrentPageOnly();
$recordCheckboxPosition = $getRecordCheckboxPosition();
$isStriped = $isStriped();
$isLoaded = $isLoaded();
Expand Down Expand Up @@ -259,6 +260,8 @@ class="fi-ta-header-toolbar flex items-center justify-between gap-x-4 px-4 py-3
<x-filament-tables::selection.indicator
:all-selectable-records-count="$allSelectableRecordsCount"
:colspan="$columnsCount"
:page="$this->getTablePage()"
:select-current-page-only="$selectsCurrentPageOnly"
x-bind:hidden="! selectedRecords.length"
x-show="selectedRecords.length"
/>
Expand Down

0 comments on commit 29add93

Please sign in to comment.