How to refresh DataTable with server side processing and scroller plugin
How to refresh DataTable with server side processing and scroller plugin
Mike 2015
Posts: 1Questions: 1Answers: 0
I was tried to use these approaches:
1. Using api().draw(false) function, but it resets scroll offset
2. Using api().ajax.reload(null, false). It resets scroll offset too.
3. Using dataTable._fnDraw() function. It doesn't work too. There is a bug when you are trying a bit scroll and after _fnDraw() call it scrolls to previous position. When you are scrolling a lot - it works well.
My TypeScript code:
var dataTableOptions = {
serverSide: true,
ordering: true,
searching: true,
columns: [
{ "data": "id" },
{ "data": "workflowId" },
{ "data": "discovery" },
{ "data": "title" },
{ "data": "createdBy" },
{ "data": "createDate" },
{ "data": "status" }
],
ajax: (data, callback, settings) => {
// server side service call
},
dom: 'rtiS',
scrollY: 400,
scroller: {
rowHeight: 35,
loadingIndicator: true
},
initComplete: function () {
forceRefresh = _.throttle(() => {
//this.api().ajax.reload(false);
this._fnDraw();
}, 1000);
setInterval(() => {
forceRefresh();
}, 5000);
}
}
This discussion has been closed.