I used the jquery dataTable plugin
to show a table which contains (username, dates, and email).
I want to disable the filtering/search for the username and email columns and enable just the search for the dates. when I click on the search field I'll open a calendar to choose the date which we will look for.
I just want to use this plugin for filtering only dates, basically. Can this be done?
-edit--
I read the docs :dateRange But It doesn't work for me I added the
('.dataTable').dataTable()
.columnFilter({
sPlaceHolder: "head:before",
aoColumns: [null, { type: "date-range" }, null]
});
And I duplicated the headers but I can't get the date fields or any other field to search the data into.
You can use column().search()
to obtain search on specific value, ex:
var table = $('#example-table').DataTable();
$('#search-input').on('change', function(){
table
.column(4)
.search(this.value)
.draw();
});
Working Demo
Refrences
There are multiple ways of doing this and one of them is mentioned follow which i personally felt is the easiest one, with the following you define which columns NOT TO LOOK FOR while searching using datatable search.
$('#example').dataTable( {
'columnDefs' : [
{
'searchable' : false,
'targets' : [0,2,3]
},
]
} );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With