Using Pipeline and need to reload/redraw table

Using Pipeline and need to reload/redraw table

rosinscjrosinscj Posts: 8Questions: 0Answers: 0
edited October 2010 in General
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.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi rosinscj,

    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
  • rosinscjrosinscj Posts: 8Questions: 0Answers: 0
    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.
  • rosinscjrosinscj Posts: 8Questions: 0Answers: 0
    edited October 2010
    I re-read the api:

    oTable.fnDraw(false);

    will re-draw without re-sorting. This works perfectly!

    Thank you again.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Sorted :-). Yup fnDraw(false) is probably always good enough with server-side processing. I'll consider making that the default in future for SSP...

    Allan
This discussion has been closed.