Using ajax.relaod isn't updating the value that is being passed to the controller.
The variables have the correct values each time when entering the function but I'm not sure how to get reload to also see/accept the updated variables.
Do I need to destroy and rebuild the table each time?
if (!$.fn.DataTable.isDataTable('.workorder-table')) {
$('.workorder-table').DataTable({
"initComplete": function () {
hidePleaseWait();
},
rowCallback: function (row, data, index) {
--row classes added here based on data
},
columns: [
{ "data": "Facility", "name": "Facility", "title": "Facility" },
{ "data": "ShortDescription", "name": "ShortDescription", "title": "Short Description" },
{ "data": "Created", "name": "Created", "title": "Created" },
{ "data": "Completed", "name": "Completed", "title": "Completed" },
{ "data": "Status", "name": "Status", "title": "Status" }
],
ajax: {
url: "/Facility/WorkOrderSearch",
type: "POST",
data: { status: $('#Status').val(), facilityID: $('#FacilityID').val(), quickView: $('#QuickView').val() }
},
-- options here
});
} else {
$('.workorder-table').DataTable().ajax.reload(hidePleaseWait);
}
datashould be a function, i.edata: function(d) { d.status: $('#Status').val() ,... }then it will be executed uponajax.reload()