Advanced Tables Filter Not Adding Filter
What I'm trying to do:
Hello, this is a very simple table, I'm trying to add an Advanced Table Filter for "created_at". Thank you in advance, maybe I'm doing something wrong, maybe something is wrong with the package?What I did:
I added a simple filter to the tableMy Issue/The error:
My filter is be removed (and not shown on in the filter menu) by the following code:Archilex\AdvancedTables\Filters method getCollectedFilters on line 110 using version 3.7.27 of package archilex/filament-filter-setsThe line in question is removing all filters where it's an instance of AdvancedFilter (which makes no sense)
My Code:
Solution
This was already discussed offline earlier today, but since I’m just now seeing this was posted here too I’ll respond here too:
The issue you are having is the DateFilter is what I call a “columnFilter” this means you need to use the
So to break it down:
If you want to autogenerate your filters based on your table columns (including ‘created_at’) then all you need is:
If you just want the DateFilter for created at then you can pass that into the
You only need to use the
Hope that helps!
p.s. please use the advanced-tables channel and feel free to tag me so I get notified.
The issue you are having is the DateFilter is what I call a “columnFilter” this means you need to use the
->includeColumns() method on your filter. So to break it down:
If you want to autogenerate your filters based on your table columns (including ‘created_at’) then all you need is:
If you just want the DateFilter for created at then you can pass that into the
->includeColumns() method:You only need to use the
->filters() method if you want to a) don’t want to autogenerate filters (which also means you can’t use column filters), b) you want to override a column filter, or c) if you want to include a custom filter (ie filter data on your table where you don’t have a column for it)Hope that helps!
p.s. please use the advanced-tables channel and feel free to tag me so I get notified.