F
Filament3mo ago
DeDe

How to not display data in widget table except if a filter is selected ?

Hi, I want to display data only if a filter is selected by user. If anyone can help me, it will be appreciate ! Thanks for your help !
Solution:
Maybe this? ```php ->modifyQueryUsing(function (Builder $query, Table $table) { $query->when(! $table->isFiltered(), fn (Builder $query): Builder => $query->whereId(0)); })...
Jump to solution
5 Replies
Solution
LeandroFerreira
LeandroFerreira3mo ago
Maybe this?
->modifyQueryUsing(function (Builder $query, Table $table) {
$query->when(! $table->isFiltered(), fn (Builder $query): Builder => $query->whereId(0));
})
->modifyQueryUsing(function (Builder $query, Table $table) {
$query->when(! $table->isFiltered(), fn (Builder $query): Builder => $query->whereId(0));
})
DeDe
DeDe3mo ago
Thanks you , i will try !
DeDe
DeDe3mo ago
It work like a charm ! thanks you again ! Now I'm looking to replacing the message : "no record found" to "Select a filter"
No description
DeDe
DeDe3mo ago
Sorry, i've search without the good searchs terms !