Posted on February 03, 2020 at 13:30 (GMT +00:00) by
Colin
Today I'm going to show you how you can create combobox dropdown filters for
Datatables. In my example I am using
Bootstrap and
JQuery as my base libraries.
So the idea is, when there are more than 1 column entry that is different, a combobox will display above the column, but below the actual header which includes the ordering event.
I am going to assume that you have experience using JQuery and jump straight in.
The first thing you need is your table.
Next up, on your Datatable initialisation, you'll need the option
orderCellsTop as true followed by an
initComplete function that will perform the thead update.
If you would like to hide the original filter box you can call
Your whole initalization script should look something like this:
If you find this useful or If you require an explanation of the code, just drop me a comment and I'll get back to you.
/signing off