Reputation: 701
I am using data table from here. I have implemented column wise select filter. I would like to implement a mixed of select and search filter for my table. In other words, say I have 3 rows : No
, Name
, Address
. The No
column should have a search filter. The Name
should have a select filter and the Address
should have a search filter. How can I achieve this? Any sample code can help to modify it to my real application.
Upvotes: 0
Views: 1012
Reputation: 50540
You can accomplish this utilizing the Column Filter plugin
('#example').dataTable().columnFilter({
aoColumns: [
{ type: "text" },
{ type: "select", values: [ 'Adam', 'Bob', 'Casey', 'Dave'] },
{ type: "text" }
]
This sets up a filter for each column. The first column will be text, second a drop down containing the names listed in values
and the third another text box.
If you want your No
column to be a numeric range, you can do this instead:
{ type: "number-range" }
If you just want to search a single number, you can make it:
{ type: "number" }
Upvotes: 2