laravel-livewire-tables
laravel-livewire-tables copied to clipboard
[Bug]: MultiSelectFilter options not disabled when selecting "All"
What happened?
When interacting with a MultiSortFilter and selecting the "All" option (or selecting everything other than "All" manually), it shows all of the checkboxes as checked, and the table rows are filtered as I'd expect.
However, I'm still able to uncheck individual options, which doesn't automatically uncheck the "All" option.
In this state I would expect that if I uncheck the "All" option, it would uncheck everything. Instead it makes everything checked except for "All". Now the state of "All" is opposite to what is actually selected.
I saw in the boilerplate example that the filter there is actually changing the "checked" and "disabled" attributes on the elements to prevent this. These attributes are never added in my app though. I searched for awhile in the example code, package source and HTML markup to find where this functionality might be happening but I couldn't find it.
https://github.com/user-attachments/assets/be8dd92e-d80e-46dc-80ae-78a8cabd4b6e
I can't tell whether this is:
- A bug/config issue
- Something that was removed since the version (v2, I'm on v3) the example uses
- Something you always needed to do yourself and I missed where the example is doing this
How to reproduce the bug
I created a new Laravel project to make sure no issues were caused by my non-standard project (my actual app uses Roots Acorn). I followed the "Recommended" configuration setup in the docs.
https://github.com/me-julian/laravel-testing has instructions in the readme if you'd like to exactly recreate what you can see in the video.
This seems to happen with the most barebones table and filter though. Here's my Data Table Component.
public function filters(): array
{
return [
MultiSelectFilter::make('id')
->options([
'1',
'2',
// . . ,
'9',
'10'
])
->filter(function (Builder $builder, array $values) {
$builder->whereIn('id', $values);
})
];
}
Package Version
3.4.22
PHP Version
8.2.x
Laravel Version
10.48
Alpine Version
Unknown (Whatever's bundled with Livewire v3.5.9)
Theme
Tailwind 3.x
Notes
No response
Error Message
No response