Hide all records in the table
Hi, I have a question: how can I hide all records in the table as long as a filter option is not selected?
For example, records should only appear when I select an academic period; otherwise, nothing should appear in the table.
Solution:Jump to solution
Thank you very much, I have modified it a little and it worked.
```php
->modifyQueryUsing(fn ($query, $livewire) => $query
->when(...
10 Replies
You could do something like this to filter all before a filter was selected:
Sorry, where should this code go?
On the table definition of your resource
Not 100% sure whether it's correct but should point you in the right direction
Solution
Thank you very much, I have modified it a little and it worked.
You shouldn’t need to apply filters manually though
I understand, but for this table I needed it that way, since I don't want all the records to be mixed up.
Not sure what you mean be „mixed up“ but the filter behavior should be the same as your query 🤔
That is to say, I don't want all the records of the table to appear, only the filtered ones, otherwise it will be too confusing.
Which is what a filter should do. Right? 😅 Filter plus the addition we did in the beginning.
Yes, in the end the result would be like this, I hide the columns in the table but I show them in the filter