How can I have a dropdown of months to filter my table as opposed to dates?
How can I have a dropdown of months to filter my table as opposed to dates?
Hello,
Please bear with me, working with DataTables has caused me a loss of sleep haha.
I have built up and destroyed my datatable numerous times because I can't get it to work how I need it. Basically, I wish to populate a dropdown list with month periods from my DB (e.g. Jan 2015, Feb 2015, Mar 2015) - this bit is easy. The column in my datatable that I wish to filter on this data is in the same format, that is, there is a month column with Jan 2015, Feb 2015 etc. When I select the month from the dropdown, I wish the data in the table to only show records where the month column == the dropdown value.
I believe this should just be a simple string match on the month column correct? How can I do this? Like I said, I am losing sleep over this haha. Thanks guys :-)
- Rachel
Answers
Anyone?
You can also try my yadcf plugin, see showcase , notice the first column which uses the
filter_type: 'custom_func'
, you can place your month there and write a custom function that will be executed for each row and return true/false in case of match, scroll down on that showcase page to see code snippet.