FnDeletrow and FnDraw not working sometimes
FnDeletrow and FnDraw not working sometimes
hi,
I am trying to remove a row from the datatable once the row has been deleted from the server using oTable.fnDeleteRow( 0 );. This works sometimes and sometimes the row is not deleted and I have to refresh the page to reload data from server , any idea why ? I also have the same issue with oTable.fnDraw(); I call this function to redraw the datatable once a set of rows are deleted from the server based on an ajax post on a button click. Any help would be appreciated. I am not sure why this is happening randomly.
some settings for that table is as follows:
'bServerSide' : true,
'bAutoWidth' : false,
'bStateSave': true,
'bJQueryUI': true,
'sPaginationType': 'full_numbers',
I am trying to remove a row from the datatable once the row has been deleted from the server using oTable.fnDeleteRow( 0 );. This works sometimes and sometimes the row is not deleted and I have to refresh the page to reload data from server , any idea why ? I also have the same issue with oTable.fnDraw(); I call this function to redraw the datatable once a set of rows are deleted from the server based on an ajax post on a button click. Any help would be appreciated. I am not sure why this is happening randomly.
some settings for that table is as follows:
'bServerSide' : true,
'bAutoWidth' : false,
'bStateSave': true,
'bJQueryUI': true,
'sPaginationType': 'full_numbers',
This discussion has been closed.
Replies
Sounds like sometimes the redraw happens before the deletion of the row from your database takes place.
When do you call fnDraw/fnDeleteRow()? In the success handler of the ajax.post? You need to ensure, that the serverside deletion of your row is done before redrawing the table.
fnDeleteRow by default redraws the table (http://datatables.net/api#fnDeleteRow).
So what you need to do is send an Ajax call to the server to delete the row, and then simply call fnDraw in the Ajax callback function.
Allan
I am doing the fnDraw/fnDeleteRow() after the successfully getting a response from the ajax call to server which deletes the data and when I refresh the page I can see that the row is deleted which means it is deleting from the database. My understanding is that we fnDraw() makes a call to the server and draws the table again with fresh server data. In my case this works sometimes and then stop removing row / redrawing the table without any specific reason.
If you post a link we can take a look through the debugger.
We are not calling fnDeleteRow.
Allan
We may also try to remove the record from the pipeline's cache so that we don't have to round trip to the server just for a delete.