F
Filament8mo 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
LeandroFerreira7mo 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
DeDeOP7mo ago
Thanks you , i will try !
DeDe
DeDeOP7mo 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
DeDeOP7mo ago
Sorry, i've search without the good searchs terms !
Want results from more Discord servers?
Add your server