diff --git a/packages/tables/docs/08-grouping.md b/packages/tables/docs/08-grouping.md index 1fc5000c2a..63f77d91d5 100644 --- a/packages/tables/docs/08-grouping.md +++ b/packages/tables/docs/08-grouping.md @@ -337,3 +337,18 @@ public function table(Table $table): Table ->groupingSettingsHidden(); } ``` + +### Hiding the grouping direction setting only + +You can hide the grouping direction select interface using the `groupingDirectionSettingHidden()` method: + +```php +use Filament\Tables\Table; + +public function table(Table $table): Table +{ + return $table + ->defaultGroup('status'); + ->groupingDirectionSettingHidden(); +} +``` diff --git a/packages/tables/resources/views/components/groups.blade.php b/packages/tables/resources/views/components/groups.blade.php index f875fd43e4..4cce2a84ad 100644 --- a/packages/tables/resources/views/components/groups.blade.php +++ b/packages/tables/resources/views/components/groups.blade.php @@ -1,4 +1,5 @@ @props([ + 'directionSetting' => false, 'dropdownOnDesktop' => false, 'groups', 'triggerAction', @@ -71,23 +72,24 @@ - + @endif @@ -116,23 +118,24 @@ - + @endif @endif diff --git a/packages/tables/resources/views/index.blade.php b/packages/tables/resources/views/index.blade.php index 78d6cabb9c..20d0a45f5e 100644 --- a/packages/tables/resources/views/index.blade.php +++ b/packages/tables/resources/views/index.blade.php @@ -42,6 +42,7 @@ $isReorderable = $isReorderable(); $isReordering = $isReordering(); $areGroupingSettingsVisible = (! $isReordering) && count($groups) && (! $areGroupingSettingsHidden()); + $isGroupingDirectionSettingHidden = $isGroupingDirectionSettingHidden(); $isColumnSearchVisible = $isSearchableByColumn(); $isGlobalSearchVisible = $isSearchable(); $isSearchOnBlur = $isSearchOnBlur(); @@ -195,6 +196,7 @@ @if ($areGroupingSettingsVisible) isGroupingDirectionSettingHidden = $condition; + + return $this; + } + public function defaultGroup(string | Group | null $group): static { $this->defaultGroup = $group; @@ -130,6 +139,11 @@ trait CanGroupRecords return (bool) $this->evaluate($this->areGroupingSettingsHidden); } + public function isGroupingDirectionSettingHidden(): bool + { + return (bool) $this->evaluate($this->isGroupingDirectionSettingHidden); + } + public function getDefaultGroup(): ?Group { if ($this->defaultGroup === null) {