Is there a way I can stop it from sending all of the columns to the server?
Currently the AJAX request looks like:
ssp.php?draw=2&columns%5B0%5D%5Bdata%5D=id&columns%5B0%5D%5Bname%5D=&order%5B0%5D%5Bcolumn%5D=10&order%5B0%5D%5Bdir%5D=asc&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&_=1448240832750
But it's 5689 characters long. I'm looking for a way to disable all of the column data that isn't necessary. Is this possible?
if you use GET
try to remove unnecessary column.
$('#your-table').DataTable({
serverSide: true,
processing: true,
ajax: {
url: 'url-here',
data: function (data) {
for (var i = 0, len = data.columns.length; i < len; i++) {
if (! data.columns[i].search.value) delete data.columns[i].search;
if (data.columns[i].searchable === true) delete data.columns[i].searchable;
if (data.columns[i].orderable === true) delete data.columns[i].orderable;
if (data.columns[i].data === data.columns[i].name) delete data.columns[i].name;
}
delete data.search.regex;
}
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With