Can ServerSide Datatable Custom Filter Plugin send altered request on first draw?
Can ServerSide Datatable Custom Filter Plugin send altered request on first draw?
I am writing a custom plugin for a server-side datatable that adds additional filter parameters in the request sent to the server.
However, the first request the datatable sends is the original request without the additional filter parameters.
Currently I have a workaround by using the deferLoading option and waiting for the plugin to trigger the first draw. However, I want to know if it's possible to have the datatable load and send the plugin request immediately on the first draw.
// where we build request with filters added
$(self.dataTable.table().node()).on('preXhr.dt', function(e, settings, json){
for ( var i = 0; i < json.columns.length; i++ ){
json.columns[i].filter = {
value: null,
operator: null
};
}
});
self.dataTable.draw();