Date filter outside datatable

Date filter outside datatable

pavanhk89pavanhk89 Posts: 1Questions: 0Answers: 0
edited October 2013 in General
I need to filter datatable based on date range, i tired using custom filter but the filter is applied only once, all the unmatched records get deleted from datatable.

here is my code :
oTable.dataTableExt.afnFiltering.push{
function( oSettings, aData, iDataIndex ) {
var fromDate = new Date($( "#applicationDateFrom" ).val());
var toDate = new Date($( "#applicationDateTo" ).val());
var cellDate = new Date(aData[4]);
cellDate.setDate(cellDate.getDate()+1);
//alert(cellDate);
if(cellDate < fromDate){
return false;
}else if(cellDate > toDate){
return false;
}else
return true;

})
}

Whats wrong in this code, how can i reset the custom filter ?

I tried using column filter plugin but that doesn't suit my requirements as I have the date pickers outside the datatables.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Core looks okay. Please link to a test case showing the problem.

    You can refilter the table just by calling fnDraw .

    Allan
This discussion has been closed.