Important: Advanced Indicators is one of the biggest additions to Advanced Tables since it’s initial launch and I’m very excited to be able to bring this functionality to Filament. However, since there are still outstanding features to be implemented, known limitations that are under development, and there may be custom Filament implementations that haven’t been accounted for, I am launching this as a beta feature. Please read all the instructions fully to know what is currently supported, what is under development, and what may not be supported. If you do find an issue, please reach out to me on discord our through email.Advanced Indicators gives your users quick access to their filters through Filament’s indicator system. When enabled, each indicator can be clicked on to access that filter’s settings. In addition, filters can be favorited and “pinned” so they always appear, even when not active.
Updating to the Advanced Indicators Beta
-
Update to the beta
To update to the beta update your
composer.jsonfile to: -
Compile assets
After updating be sure to run
npm run buildandphp artisan filament:upgrade. -
Update Custom Filter Classes
Advanced Indicators automatically overrides any default Filament filters you have included in your resource or page. However, any custom filter classes that you have created that extends a Filament filter will need to be updated to use Advanced Table’s versions. This can be easily accomplished by just updating your imported class with the plugins equivalent:
Remember, you only need to override custom filter classes you have created. Filters used within Filament’s resources and pages will be overridden automatically.
-
Enable Advanced Indicators
Advanced Indicators is disabled by default. To enable, add
advancedIndicatorsEnabled()to your panel provider: - Add the AdvancedTables trait If you haven’t already, add the AdvancedTables trait to your table.
- Install Managed Default Views (optional) If you would also like to use the new Managed Default Views, follow these instructions.
Using Advanced Indicators
Once enabled, Advanced Indicators should work right out the box with minimal configuration. Just click on any indicator to see the form field(s) associated with that filter. Any adjustments to that filter will be immediately reflected in the table and synced to filament’s filter form.Custom Filters with Multiple Form Fields
When implementing custom filters with multiple form fields in Filament, there are two main ways to display the indicator(s). You could display a single indicator that adapts according to the fields that are set, or you could have individual indicators for each field. As an example, take the following date filter examples which have two date fields, but display the indicator differently. Example 1 - Display as a single indicator:
->multipleIndicators() method:
Example 1 - Display as a single indicator:
Note: Displaying indicators outside of these two examples (ie. a single indicator for all form fields, or a one-to-one field/indicator setup), is not currently supported. If you have a filter set up like this, please contact me.
Favorite Filters
Advanced Indicators not only gives you quick access to applied filters, but also allows you to specify “favorite” filters which will always be displayed in the indicator bar, even when the filter is not active. You can make a filter a favorite by using the ->favorite() method:
Note: Support for Filament’s ->columns() method on filters is coming soon.
Limiting the Indicator labels
Advanced Indicators also introduces the ability to limit the number of labels that are shown on a Select Filter. Since you now have easy access to filters through the indicator, it may not be necessary to pollute the indicator bar with an excessively long indicator. To limit the indicator labels you may use the ->limitIndicatorLabels() method:
& 3 more will be displayed. However, you may change this by publishing and updating the plugin’s language files and updating the more_indicator_labels value in the advanced-tables.php language file:
Specifying Favorite Filters in Preset Views
If you are using Preset Views you may configure which filters should be displayed as favorites using the->defaultFavoriteFilters() method:
Note: When defining default favorite filters, the order of the filters will be determined by the order they are in listed in Filament’s ->filters() array. Support for ordering by the order of the ->defaultFavoriteFilters() array is coming.
Specifying Favorite Filters with User Views (Under Development)
User-specified favorite filters is currently under development and should be released soon. When released, your users will be able to favorite, rearrange, and even hide filters according to their needs and then save that configuration as a User View.Deferring Advanced Indicators
The current implementation of Advanced Indicators is for each indicator form to be live even if you are using Filament’s filter deferring. Since each indicator is a subset of all the filters, deferring a single filter doesn’t seem necessary. However, if there is sufficient demand/need for it, I will look into bringing deferring to Advanced Indicators in the future. If implemented, each indicator dropdown would have it’s own “Apply” button. Please contact me if this is a feature you need.Current Limitations and Unknowns
While Advanced Indicators should work for the majority of implementations, there are currently a few limitations and unknowns:- Advanced Filter Builder is not currently supported, but under development.
- Custom filters may not be fully supported, but the goal is to support any implementation with Filament’s filters. If something is not working as expected please contact me.
- Third-party filter plugins have not been tested. If a filter plugin is not working, please contact me. Please note, that full support may require the plugin developer to update their filter.
- Filament’s Query Builder Filter is not currently supported. I am looking into supporting it, but if support comes it will be at the very end of this development period.
Disabling Advanced Indicators
If you wish to disable Advanced Indicators, you may pass false to the->advancedIndicatorsEnabled() method: