how to use Datatable .columnFilter() for date column?
how to use Datatable .columnFilter() for date column?
a.)I am using a datatable with "INDIVIDUAL SEARCH" from this link https://datatables.net/examples/api/multi_filter.html#
b.) I want to add datepicker "from" to "to" on date columns, I have 2 date columns in my table.
c.) the above java script is for text search only , how can I add date-range or datepicker in it ?
d.) which .js files I need to add for columnFilter() add on ? please help to use column filter for 2 date columns and other individual search should be as it is.
my code is :
$(document).ready( function () {
// DataTable
var table= $('#example ).DataTable( {
"processing": true,
"deferRender": true, // to make the search fast
dom: 'C<"clear">lfrtip',
colVis: {
restore: "Restore"
},
"ajax": {
"url": "/example .so",
"type": "GET"
},
"columns": [
{ "title": "customer Id", "data": "customerid ", "name": "customerid" },
{ "title": "customer Name", "data": "customer name", "name": "customer name" },
{ "title": "Maintenance Date", "data": "maintenanceDate", "name": "maintenanceDate"},
{ "title": "Added Date", "data": "addedDate", "name": "addedDate"}
});
// Setup - add a text input to each footer cell
var noofcolumn= $('#example thead th').length;
colmn="";
for(i=0; i<noofcolumn; i++)
{
var title = $('#example thead th').eq( i ).text();
colmn+='<th><input type="text" placeholder="Search '+title+'" /></th>';
}
$('#example tfoot').html( colmn );
// Apply the search
table.columns().every( function ()
{
$('input', this.footer() ).on( 'keyup change', function () {
table
.column( $(this).parent().index()+':visible' )
.search( this.value )
.draw();
} );
});
Answers
can anybody help me out ?? thanks in advance