fnDeleteRow doest not delete When using ServerCall to load Data

fnDeleteRow doest not delete When using ServerCall to load Data

blpraveen2004blpraveen2004 Posts: 15Questions: 2Answers: 0
edited March 2014 in DataTables 1.9
I modified the dataTable to load using a fnServerData. But fnDeleteRow doesnot deleting the rows now.

[code]


/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
return oTableLocal.$('tbody tr.row_selected');
}

//DataTable

oTable = $('#table_data').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": woocommerce_writepanel_params.ajax_url,
"fnServerData": fnDataTablesPipeline,
"bAutoWidth": false
});

//Performing Ajax function to delete the selected rows
var anSelected = fnGetSelected( oTable );
jQuery.ajax({
type: "POST",
data: post_data,
url: 'ajax.php',
success: function(response) {
$('#variable_product_options').stop(true).css('opacity', '1').unblock();
$.each(anSelected,function(i,v) {
oTable.fnDeleteRow(anSelected[i]);
});
}
});
[/code]

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    Since you are using server-side processing, just call fnDraw to redraw the table. fnDeleteRow is not required in this case, since the row has been removed from the data source (the server).

    Since you are using pipelining you'd need to empty the pipeline as well. Otherwise, obviously, it will use the cached data.

    Allan
  • blpraveen2004blpraveen2004 Posts: 15Questions: 2Answers: 0
    edited March 2014
    Here is the link to the dataTable http://shop2build.com/fawaaz/product/ace-exterior-emulsion-10lts/. Colud you help How will I reload from the pipeline after empty the cache?
  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    Using the old pipeline code, simply do:

    [code]
    oCache.iCacheLower = -1;
    table.fnDraw();
    [/code]

    to do a full refresh from the server.

    The new pipeline code for 1.10 adds an API method to DataTables to allow the cache to be emptied on a per table basis.

    Allan
  • blpraveen2004blpraveen2004 Posts: 15Questions: 2Answers: 0
    Thanks for provding the line of code to insert. I have one more issue with pagination
    I have set pipeline limit to 50, pagination is not working after I go to 5th page.

    Link to page
    http://shop2build.com/fawaaz/product/tractor-emulsion-smooth-wall-finish-10-lts-2/

    And also processing does not go off after load.
This discussion has been closed.