No matching records found, without any error ?
No matching records found, without any error ?
erpankajs
Posts: 4Questions: 0Answers: 0
I am playing with datatable to create fully functional view. Such as export like csv, xls, print, pdf, date range, user name and site name filter. firstly i am creating date range filter as per given docs by datatables.net.
Its working fine for first step daterange filter, But suddenly no record shown.
Here;s my code:
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var iFini = document.getElementById('startDate').value;
var iFfin = document.getElementById('endDate').value;
var iStartDateCol = 5;
var iEndDateCol = 5;
var datofini = aData[iStartDateCol];
var datoffin = aData[iEndDateCol];
if ( iFini === "" && iFfin === "" ) {
return true;
} else if ( iFini <= datofini && iFfin === "") {
return true;
} else if ( iFfin >= datoffin && iFini === "") {
return true;
} else if (iFini <= datofini && iFfin >= datoffin) {
return true;
}
return false;
}
);
var rptTable = $('#tblo').DataTable({
"aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, "All"]],
"iDisplayLength": 5,
"sAjaxSource": "ajax.php?do=getRptIncident&filter=getIncRpt",
"stateSave": true,
"columns": [
{ "data": "incident_id" },
{ "data": "site_name" },
{ "data": "full_name" },
{ "data": "incident_name" },
{ "data": "report" },
{ "data": "created_at" },
{
"data": null,
"className": "action",
"defaultContent": '<div class="btn-group" role="group" aria-label=""><button type="button" id="viewMap" class="btn btn-sm btn-default" >Map</button><button type="button" id="viewFiles" class="btn btn-sm btn-default">Files</button></div>'
}
],
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false }
],
"createdRow": function (row, data, rowIndex) {
$.each($('td.action', row), function (colIndex) {
$(this).find('button#viewMap').attr({
'data-lat': data['lat'],
'data-lng': data['lng']
});
$(this).find('button#viewFiles').attr('data-incident-id', data['incident_id']);
});
},
"sDom": "<'row'<'col-sm-3'l><'col-sm-6 text-center'B><'col-sm-3'f>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [
'excelHtml5',
'csvHtml5',
'pdfHtml5',
{
extend: 'print',
customize: function ( win ) {
$(win.document.body)
.css( 'font-size', '10pt' );
$(win.document.body).find( 'table' )
.addClass( 'compact' )
.css( 'font-size', 'inherit' );
},
exportOptions: {
columns: ':visible'
}
},
{
extend: 'collection',
text: 'Show Columns',
buttons: [ 'columnsVisibility' ],
visibility: true
}
]
});
In data table debuger to found the issue, but still not found any issue. Here the debuger code
Upload complete - debug code: ijuguh (view)
Suggest me how to fix this issue.
This discussion has been closed.
Replies
Thanks for your question - however, can you link to a test case showing the issue please. This will allow the issue to be debugged as the debugger doesn't provide everything needed here.
Information on how to create a test page], if you can't provide a link to your own page can be found here.
Thanks,
Allan