I have a JQuery Datatable that is defined in a JS Module. And, elsewhere, I'm trying to reload it with the help of Datatable's ID selector. Here, I want to pass in new request post data which I'm having trouble with.
My attempt :
In Module A:
$(selectors.Datatable)
.DataTable({
bProcessing: true,
serverSide: true,
ajax: {
data: initialPostData,
url: urls.read,
method: 'POST'
},
columns: [...],
autoWidth: false,
searchDelay: 500
});
In Module B:
var newPostData = [...];
var dataTableWidget = $(selectors.datatableSelector).DataTable();
dataTableWidget.ajax.params(newPostData);
dataTableWidget.ajax.reload();
I was expecting dataTableWidget.ajax.params(newPostData);
should be post new data in the ajax request. But it isn't.
Update
params
is not the one that is going to help here. From documentation:
Get the data submitted by DataTables to the server in the last Ajax request