[FUELCMS] Add a dropdown filter on item listing page
I m working on Fuelcms again for one of my long-term project, after spending some time to create a feature which you can’t find on the documentation , I have this idea to write a series of blog post on how I did some of the features by using Fuelcms . The admin on Fuelcms forum is really helpful , I guess this is my way to contribute back to the Fuelcms community.
This tutorial is suitable for Fuelcms user who have follow the documentation create advance module, but if you try to find a solution for this ,most likely you want to have this feature on your advance module, so I assume that you understand the basic concept and folder structure of advance module.
The item listing page on Fuelcms is a very standard page, you can find it on almost every module, it provide a search filter, which allow you to search any field that you defined , but what if you want to have a drop down field to filter the result ?
Assume my module is call “Operation”.
1. First you need to edit operation/config/operation_fuel_modules.php , the should be some config file for your module, add in this filters config. You just need to add in the filters config.
- date_added is the field name , the field that you want to filter the listing.
- default is for the default value, in this case the default value is set to ‘all’.
- label is a tiny text that show beside your drop down filter.
- type will be the field type, if you never set it as select, it will be a text box input.