fnDraw() functionality is inconsistent

fnDraw() functionality is inconsistent

readyleereadylee Posts: 6Questions: 0Answers: 0
edited June 2011 in Bug reports
Hi,

I am using DataTables and it's great, but I am witnessing inconsistent behavior with the fnDraw(false) function.
I have an object in each page (var oTable) which is a dataTable instance. Particularly after performing a delete operation, I call oTable.fnDraw(false). Most of the time, the table is re-drawn as expected, and the deleted record is no longer there. However, sometimes the re-draw doesn't seem to happen. If I re-fresh the page then I can see that the record has been removed, but I am wondering why my call -- oTable.fnDraw(false) -- doesn't seem to be executed every time, or is ineffectual. The crazy thing is that now I'm calling it about 4 times for a single delete operation, but I still sometimes need to refresh the page in order to see that the record has been deleted. Please advise!

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    Can you give us a link showing this problem please? It's not something that I've encountered myself.

    Allan
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    Thinking about it - fnDeleteRow will redraw the table by default - is that how you are deleting the row?

    Allan
  • readyleereadylee Posts: 6Questions: 0Answers: 0
    I cannot provide a publicly accessible URL unfortunately. As for using fnDeleteRow....well, that's what I tried to do initially. But with that I incurred the problem I mentioned here: http://datatables.net/forums/comments.php?DiscussionID=5078&page=1#Item_3 , where the redraw takes me to a previous page of my DataTable. So I decided not to use that function anymore, and put my money on fnDraw(false). This seemed frugal, since what I really want to do is: delete the record (from the database), and then re-draw the table. So that's what I'm doing now.... But fnDraw() seems to be temperamental.
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    It would be possible to create a plug-in API method which would do a 'standing delete' something along these lines: http://datatables.net/plug-ins/api#fnStandingRedraw .

    However, that doesn't explain why fnDraw(false) would sometimes work and sometimes not. I think I'll need more information in order to help though... For example are you using server-side processing? If so, are you firing of the redraw XHR at the same time as the delete XHR - might they be overlapping? I would say that the redraw call should be in the delete callback.

    Allan
This discussion has been closed.