rappasoft/laravel-livewire-tables

[Feature Request]: Clear filters (setFilterDefaults) clears all set filters, even the default ones

RenoLooijmans opened this issue · 2 comments

What happened?

Clicking the 'clear filters' button clears all set filters and does not set it to the default filters. In the code, setFilterDefaults calls resetFilters, which in turn calls setFilters with $filter->getDefaultValue() as a parameter. This always returns null (hard set in the code). I don't think this is correct.

Either the function call should be renamed to setClearFilters (and clear all filters like it does now), or the setFilter called by resetFilters should call $this->getFilterDefaultValue().

How to reproduce the bug

Click clear filters button when filters are applied.

Package Version

2.15

PHP Version

8.1.x

Laravel Version

10.24

Alpine Version

3.13

Theme

Bootstrap 5.x

Notes

No response

Error Message

No response

lrljoe commented

@RenoLooijmans - I do agree that there needs to be customisation for this, I've replied to your PR, please don't take the comments as "This is unwanted", definitely is wanted, but any new feature, needs to default to "current", with a toggle for "new/alt" behaviour.

Do reach out on Discord if you want some examples of this, and I'm definitely supportive of getting this in for both v2 and v3.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.