How to update "data" of an already initialized DataTable object?
How to update "data" of an already initialized DataTable object?
mani619cash
Posts: 1Questions: 0Answers: 0
I have code
var dtParams = {
"serverSide": true,
"ajax": {
"url": "load_items",
"data": function ( d ) {
d.extra_data = "old value";
}
},
};
var table = $('#main_listing_table').DataTable(dtParams);
Now once table is loaded, I want to modify or add more parameters that "extra_data" without destroying previous object
I tried
//this does not work
table.ajax.data = function (d) {
d.extra_data = 'new value';
};
//this does not work
table.data('dt_params', {name: 'extra_data': 'new value'});
I can see Network tab its always sending "old value"
This discussion has been closed.
Replies
Yep, it will still call the original function. You need to put the logic into the original function - do a test in there, something like: