filter with date not working when the min date not existe in table
filter with date not working when the min date not existe in table
BlidaAlg
Posts: 9Questions: 4Answers: 0
hello,
i'm triying to filter datatable with min and max date for one column , everything work only one thing when the date min is not existe in the table,
this is my code
and thanks for helping
require(['datatables', 'jquery'], function(datatable, $)
{
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var min = Date.parse($('#date').val());
var max = Date.parse($('#date_next').val());
var age = Date.parse( data[3] ) || 0; // use data for the age column
if ((isNaN(min) && isNaN(max)) ||
(isNaN(min) && age <= max) ||
(isNaN(max) && age >= min) ||
(age <= max && min <= age))
{
return true;
}
return false;
}
);
$('#date, #date_next').click(function()
{
$('#myTable').DataTable().draw();
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Is this a duplicate question of your other thread ?
Kevin
No it's not ... the first question the filter not working at all but this question it work but when i try to use a date > date existe in data base the filter not working that why i ask a new question
It work now
this is my code , thanks a lot