fnDeleteRow and bProcessing/bServerSide

fnDeleteRow and bProcessing/bServerSide

kyydkyyd Posts: 1Questions: 0Answers: 0
edited July 2013 in General
Hi, I'm looking for a bit of clarification on how these two are supposed to work together, I've read the API documentation on fnDeleteRow and several questions/answers regarding fnDeleteRow. I'm trying to remove rows from a datatable while using server side processing. I understand the actual removal of the object will have to happen on some server side code, right now I'm just trying to remove the row from the table on the clients browser.

I've got this code:
[code]






$(document).ready(function() {
var dt = $('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "data.html"
});
$("#delete").click(function() {
dt.fnDeleteRow(0, null, false);
});
});



Delete Row



Rendering engine
Browser
Platform(s)
Engine version
CSS grade







[/code]

Running here: http://cmplx.ca/dt/index.html, but when you hit the "Delete Row" button, nothing seems to happen (no row changes, no javascript errors, no network traffic). My expectation in this case would be the first row is removed from the DOM, but that doesn't seem to be happening. I've read some posts where someone implied that you should do a redraw when using server side processing(I know I'm explicitly telling it to not do that) with fnDeleteRow, but it seems wasteful to retransmit all that data and if all your doing is removing the item on the server side and redrawing what is the point of calling the fnDeleteRow method?

If the fnDeleteRow method and server side processing really don't work together without a redraw, it would be possible to just remove the tr element with the jQuery remove method on the fnDeleteRow callback(with redraw set to false), but would this affect the tables further performance(e.g. if someone then clicks a pagination link)?

Anyway thank you for taking the time to read my questions!

Replies

  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    > I'm looking for a bit of clarification on how these two are supposed to work together

    They aren't is the short answer!

    fnDeleteRow deletes a row client-side, but that's obviously useless if you have a server-side processing data source. You need to delete the row at the source and then call fnDraw to redraw the table.

    I'll update the docs to make it more clear that it is a client-side function.

    Allan
This discussion has been closed.