I have a table that is being populated by way of a repeater and I have added the relevant dataTable .css and .js to enable the plugin. This works fine and as expected. The issue I am having is how can I now enable a few 'filter buttons' which when clicked apply a string based filter to the table data. I can simulate what I want by using the actual Search Bar that you can enable, but I would prefer to have some anchor tags that serve as clickable buttons/filters to trigger this.
Example Table
ID : Type
----------
1 : Car
2 : Car
3 : Bike
4 : Bike
5 : Car
The javascript at the bottom of the page looks like this:
var table = $('#example').DataTable();
var filteredData = table
.columns( [0, 1] )
.data()
.flatten()
.filter( function ( value, index ) {
return value = 'Bike' ? true : false;
} );
I suspect there is an issue with how I am defining my search criteria, and in the example above this is attempting to set a filter on anything within columns 0 or 1 that contain the string 'Bike'.
Any help would be greatly appreciated.