Can I mix some server side configuration and client side in one data table settings?
Can I mix some server side configuration and client side in one data table settings?
Maggief
Posts: 1Questions: 1Answers: 0
I have a datatable object and the data loading, paging and sorting are made in the server side, but I want to use the filter on the top right of the column to search on cliente side and only in the selected page.
Is that possible?
I will leave the settings of my dataTable:
table = $('#rolesTable').dataTable({
lengthChange: false,
pageLength: 10,
paging: true,
searching: false,
serverSide: true,
processing: true,
ajaxSource: 'url.com',
order: [[0, "desc"]],
columns: [null, null, null, null],
aoColumns: [... some info],
columnDefs: [ ... some info],
fnServerData: function (sSource, aoData, fnCallBack) {
//Funtion to obtaing the info of the database
$.ajax({
type: "GET",
url: sSource,
data: data,
dataType: "json",
success: function (response) {
fnCallBack(response);
},
error: function (response) {
console.log(response);
fnCallBack({ data: [], recordsTotal: 0, draw: 1 });
}
});
}
});
//Definition of a new input to set the client side filter
$('#searchField').on('keyup search input paste cut', function () {
table.fnFilter(this.value);
});
This discussion has been closed.
Answers
Hi @Maggief ,
I'm afraid not. If
serverSide
is enabled, then that means paging, ordering AND searching are all done on the server.Cheers,
Colin