Using Pipeline and need to reload/redraw table
Using Pipeline and need to reload/redraw table
Good morning,
I have a datatable currently configured to use the pipeline plugin, which is working without issue.
However, I don't seem to be able to reload/redraw the the table with new data on the fly while maintaining current sort and page filters. I've tried fnDraw(), which appears to have no affect. I've tried fnReloadAjax but this dies inside the pipeline plugin since aoData is null (line 7: var sEcho = fnGetKey(aoData, "sEcho");).
fnReloadAjax line 11:
[code]oSettings.fnServerData( oSettings.sAjaxSource, null, function(json) {[/code]
fires the fnServerData line below which calls the pipeline plugin (and then dies as specified above)
My datatable initialization is the following:
[code]
oTable = $('#newTable').dataTable( {
"aoColumns":aoColumns,
"bAutoWidth": true,
"bFilter": true,
"bInfo": true,
"bJQueryUI":true,
"bPaginate": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": requestURL,
"sPaginationType": "full_numbers",
"fnServerData": function ( sSource, aoData, fnCallback ) {
jQuery.fn.dataTableExt.oApi.fnDataTablesPipeline(sSource, aoData, fnCallback);
}
});
[/code]
Any thoughts are appreciated.
Thank you.
I have a datatable currently configured to use the pipeline plugin, which is working without issue.
However, I don't seem to be able to reload/redraw the the table with new data on the fly while maintaining current sort and page filters. I've tried fnDraw(), which appears to have no affect. I've tried fnReloadAjax but this dies inside the pipeline plugin since aoData is null (line 7: var sEcho = fnGetKey(aoData, "sEcho");).
fnReloadAjax line 11:
[code]oSettings.fnServerData( oSettings.sAjaxSource, null, function(json) {[/code]
fires the fnServerData line below which calls the pipeline plugin (and then dies as specified above)
My datatable initialization is the following:
[code]
oTable = $('#newTable').dataTable( {
"aoColumns":aoColumns,
"bAutoWidth": true,
"bFilter": true,
"bInfo": true,
"bJQueryUI":true,
"bPaginate": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": requestURL,
"sPaginationType": "full_numbers",
"fnServerData": function ( sSource, aoData, fnCallback ) {
jQuery.fn.dataTableExt.oApi.fnDataTablesPipeline(sSource, aoData, fnCallback);
}
});
[/code]
Any thoughts are appreciated.
Thank you.
This discussion has been closed.
Replies
What you need to do is to force the pipeline to be effectively flushed, so it will go to the server an request the new data. The can be done by using:
[code]
oCache.iCacheLower = -1;
[/code]
so the following will do a refresh redraw:
[code]
oCache.iCacheLower = -1;
oTable.fnDraw();
[/code]
Allan
Thank you for the quick response.
That does work to reload the table. However, it reloads on page 1 w/ the sort filters reset.
I also need a way to reload while maintaining page and sort filters.
Thanks.
oTable.fnDraw(false);
will re-draw without re-sorting. This works perfectly!
Thank you again.
Allan