searchPanes error on default serverSide
searchPanes error on default serverSide

I keep getting this error message:
ajax is null
on this filedatatables.js
on this line
else if (ajax.url === '') {
// No url, so don't load any data. Just apply an empty data array
// to the object for the callback.
var empty = {};
DataTable.util.set(ajax.dataSrc)(empty, []);
callback(empty);
}
After troubleshooting, I found out that having default value for serverSide
is the reason
$.extend( true, $.fn.dataTable.defaults, {
serverSide: true,
});
how to fix this while keeping the default serverSide: true,
This question has an accepted answers - jump to answer
Answers
It sounds like you haven't defined
ajax
in the Datatables options. Server side processing requires the use ofajax
to fetch the data. If you are not usingajax
for the table data then remove theserverSide
option.Kevin
I do use ajax for all of my tables. Also all of them are
serverSide: true
that's why I have that set in datatables default.Just today, I tried to use searchPanes for the first time and got that error.
The current solution is to remove
serverSide: true
from$.fn.dataTable.defaults
and addserverSide: true
to each table initialisation but I does not make sense why it breaks when I set it as default!Sorry I missed the fact you are using SearchPanes. The default options are applied to all Datatables on the page. The SearchPanes tables are Datatables. I can think of two options:
serverSide: true
from the default options and apply to all Datatables.searchPanes.dtOpts
to setserverSide
to false, for example:Kevin
Just realized you can do this:
For example:
https://live.datatables.net/qeguyota/1/edit
But it might not work if you are setting other
searchPanes
options as I believe the default will be overwritten.Kevin
Thank you Kevin,
This solves the error message. However, searchPanes always empty.
I ended up removing
serverSide: true,
from$.fn.dataTable.defaults
then define it for each table individually.