Hi @Sherpa,
Be sure move columns
outside the ajax
function and the property name is StartYear
instead of StartDate
:
"columns": [
{ "data": "customerNumber", "name": "CustomerNumber", "autoWidth": true },
{ "data": "customerStatus", "name": "CustomerStatus", "autoWidth": true },
{ "data": "startYear", "name": "StartYear", "autoWidth": true }
]
The whole js code:
function runReport() {
var reportData;
var dataTableOptions = {
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
"columnDefs": "",
"ajax": {
url: "/eGrantsReports/ProcessReport",
type: "POST",
data: reportData,
"error": function (e) {
alert(e)
},
"dataSrc": function (d) {
console.log(d);
return d;
}
},
"columns": [
{ "data": "customerNumber", "name": "CustomerNumber", "autoWidth": true },
{ "data": "customerStatus", "name": "CustomerStatus", "autoWidth": true },
{ "data": "startYear", "name": "StartYear", "autoWidth": true }
]
}
reportData = $('#reportForm').serializeArray();
var myDataTable = $('#riskReport').DataTable(dataTableOptions);
}
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Rena