F
Filament4mo ago
monzer

how to hide table records until a filter is applied?

how to hide table records until a filter is applied?
Solution:
```php ->modifyQueryUsing(function(Builder $query, $livewire){ if(!empty($livewire->tableFilters)){ if(...
Jump to solution
5 Replies
Solution
christmex
christmex4mo ago
->modifyQueryUsing(function(Builder $query, $livewire){
if(!empty($livewire->tableFilters)){
if(
!empty($livewire->tableFilters['some_filter']['some_filter'])
){
return $query;
}
return $query->where('id',0);
}
})
->modifyQueryUsing(function(Builder $query, $livewire){
if(!empty($livewire->tableFilters)){
if(
!empty($livewire->tableFilters['some_filter']['some_filter'])
){
return $query;
}
return $query->where('id',0);
}
})
christmex
christmex4mo ago
i did sth like that you can dd the $livewire->tableFilters, to use your own filter the logic is, you check if the user did set the filter, then return something that doesnt have record, in my case i return where id 0, which is nothing then i return the query if they filter the table i hope you get the idea
monzer
monzerOP4mo ago
Thanks!
christmex
christmex4mo ago
sure, dont forget to make this question as solved
LeandroFerreira
LeandroFerreira4mo ago
GitHub
Make a table blank · filamentphp filament · Discussion #12386
Package Table builder Package Version 3.2 How can we help you? Is it possible for a table to be blank until a search has been made,. in this table public static function table(Table $table): Table ...
Want results from more Discord servers?
Add your server