Hi can someone please help me with this situation about datatables and date range filter by RadCorp
Hi can someone please help me with this situation about datatables and date range filter by RadCorp
currently I'm using a Ajax for my data to be loaded/fetch in my datatable my problem is that when i tried to run my code the datatable is not showing up even though it is being catch in the console.log that i've used for testing purpose.
and it is not working even though there is no error in the code that I'm using
$(document).ready(function() {
var table = $('#example').DataTable( {
"ajax": "js/datatables/datatableAdminGenerateFullReport.json",
"columns": [
{ "mData": "ID #" },
{ "mData": "Name" },
{ "mData": "Transaction Date" },
{ "mData": "Transaction ID"},
{ "mData": "Currency" },
{ "mData": "Amount" },
{ "mData": "Source"},
{ "mData": "Status"}
],
dom: 'Bfrtip',
lengthChange: false,
buttons: [
{
extend:'copyHtml5',
text: '<i class="fa fa-files-o"></i>',
titleAttr: 'Copy',
messageTop: 'The information in this table is copyright to AU Remit.'
},
{
extend: 'excelHtml5',
text: '<i class="fa fa-file-excel-o"></i>',
titleAttr: 'Excel',
messageTop: 'The information in this table is copyright to AU Remit.'
},
{
extend: 'pdfHtml5',
text: '<i class="fa fa-file-pdf-o"></i>',
titleAttr: 'PDF',
textAlign: 'center',
messageBotom: 'The information in this table is copyright to AU= Remit.'
},
{
extend: 'colvis'
}
]
});
table.buttons("#example_filter").container().insertAfter('#example_filter');
});
$("#min, #max").keyup( function(){
table.draw();
});
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ){
console.log("hello");
var arr_min = parseInt($("#min").val());
var arr_max = parseInt($("#max").val());
var arr_date = parseFloat(data[2]) || 0;
var iMin = new Date(Date.parse(arr_min));
var iMax = new Date(Date.parse(arr_max));
var iDate = new Date(Date.parse(arr_date));
if (iMin == "" && iMax == "")
{
return true;
}
else if (iMin == "" && iDate <= iMax)
{
return true;
}
else if (iMin <= iDate && "" == iMax)
{
return true;
}
else if (iMin <= iDate && iDate <= iMax)
{
return true;
}
return false;
}
);