Clear table before fnDataTablesPipeline

Clear table before fnDataTablesPipeline

xilaxxilax Posts: 10Questions: 0Answers: 0
edited March 2014 in General
Please how can I clear a table and show _fnProcessingDisplay only when fnDataTablesPipeline is getting the data from the server just like fnReloadAjax does with this.fnClearTable(this);

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    I recently added an option to empty the pipeline for the code in the 1.10 example: http://next.datatables.net/examples/server_side/pipeline.html .

    It adds an option to the API so you might use `table.clearPipeline().draw( false )` to redraw the table.

    This is of course dependent on using DataTables 1.10 and the new code.

    For the old version you need to modify the `oCache.iCacheLower` parameter (set it to -1) and then redraw the table.

    Allan
  • xilaxxilax Posts: 10Questions: 0Answers: 0
    Thanks for your response Allen.

    I'm using 1.9.4 and I will like to stick to that for now because I ve lots of table I wouldn't want to modify for now.

    This is the reload code
    [code]
    $(document.body).on("click", '.reloadContactsData', function(e){
    if($.fn.DataTable.fnIsDataTable($('#contactsData')[0])){
    oCache.iCacheLower = -1;
    $('#contactsData').dataTable().fnDraw();
    }
    e.preventDefault();
    });
    [/code]
    but the data is still in the table while bProcessing is display.
    What I want is to display ONLY "bProcessing" while fnDataTablesPipeline fetches the data from the server just like fnReloadAjax .
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Ah I see - there isn't an option for that - sorry. You would need to modify the DataTables core code to do that - which you are of course welcome to do, it is open source :-)

    Allan
  • xilaxxilax Posts: 10Questions: 0Answers: 0
    Ohh... I see

    I tried modifying fnDataTablesPipeline() to use .fnClearTable(this); before $.getJSON( sSource, aoData, function (json) but I couldn't reference the table. Is there a way to know the current table in the function fnDataTablesPipeline?
This discussion has been closed.