I have a page that displays one drop-down menu, since Report1 and Report2. If I select Report1, it will start startdate and enddate. I will select the start and end date, and then cliick on view report, it will make an ajax call and extract the data and display it in the table. For this I use datatable.
I have the default collation of the second coulmn, and also I can sort another column. If I sort another column, then select another Report2 report, and then select the start date and end date, and then click the view report button. Again, if I select report 1, the start and end date, and click the view report button, it sorts another column, but not the default sort column. Any help would be noticeable.
Below is my code
$('#userTable').dataTable({
"bProcessing" : false,
"bServerSide" : false,
"bFilter" : false,
"bSearchable" : false,
"oLanguage" : {
"sZeroRecords" : "No Active Users Found",
"sInfo" : "Total Records Found: _TOTAL_ "
},
"aaSorting" : [ [ 2, "asc" ] ],
"aoColumnDefs" : [ {
"mData" : "emailAddr",
"sWidth" : "20%",
"aTargets" : [ 0 ]
}, {
"mData" : null,
"sWidth" : "20%",
"mRender" : function(data, type, row) {
return row.firstNm + ' ' + row.lastNm;
},
"bSortable" : false,
"aTargets" : [ 1 ]
}, {
"mData" : "retailerId",
"sWidth" : "20%",
"aTargets" : [ 2 ]
}, {
"mData" : "role",
"sWidth" : "20%",
"aTargets" : [ 3 ]
}, {
"mData" : "contactPhone",
"bSortable" : false,
"sWidth" : "20%",
"aTargets" : [ 4 ]
} ],
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
return 'Displaying '+iStart+' to '+iEnd+' of ' +iTotal + ' entries';
}