Anyway to apply filter forms like dashboard in a custom page which include table?

I had a custom page not related to a resource which have table and some widgets. I know that can expose filtering from table to widget but, I wondering if can apply a top filter forms like what can be applied to the dashboard (Feature start from v3.1)
4 Replies
lazydog
lazydog11mo ago
Check the HasFiltersForm and InteractsWithPageFilters traits
MohamedSabil83
MohamedSabil83OP11mo ago
That's for dashboard but not works with custom pages. The filter form not shown in the custom page. I guess there's different structure only for dashboard page Just figure it after digging in the core view components. When using HasFiltersForm in custom page, you have to modify your custom page's view like the following:
<x-filament-panels::page>
@if (method_exists($this, 'filtersForm'))
{{ $this->filtersForm }}
@endif

// ... your code here

</x-filament-panels::page>
<x-filament-panels::page>
@if (method_exists($this, 'filtersForm'))
{{ $this->filtersForm }}
@endif

// ... your code here

</x-filament-panels::page>
lazydog
lazydog11mo ago
@MohamedSabil83 yes, thats the way
MohamedSabil83
MohamedSabil83OP11mo ago
We just need a way to make it render before the widgets. The structure of the core page rendering the widgets then content of the page. So, the final render will be widgets, filtersForm, the content.

Did you find this page helpful?