Okay I have a few things to ask about. I've included the jsfiddle version of my working page. I have implemented dataTables as well as a jconfirmaction plugin that was written. Say for example a user clicks on the delete icon for one of the contentpages which would bring up the confirm question and when the user clicks Yes what I would like it to do is go ahead and do an ajax somehow WITH dataTables so that it deletes it out of the database but also when it comes back then it removes it from the dataTable and refilters so that it'll update the table so that instead it'd be one less row which could mean restructuring the pagination.
2 Answers
Once you've done your ajax call you need to call this function:
4 Comments
Jeff Davidson
Thank you for the response. So your saying in the ajax for the success I need to do success: function(data) { if (data.errorsExist) { } else { fnReloadAjax() } }
Brian
it'll be like oTable.fnReloadAjax(); you should have the datatable setup as a ver/object somewhere, usually when the thing is set up.
Jeff Davidson
For some reason its not removing the row.
Jeff Davidson
The js file that I am using to deal with the js is involved in the jsfiddle. Its called contentpages.js.
Try calling
$("#my-table").fnDraw()
This tells datatables to hit the database again and redraw the data it gets back. Since your ajax call is going to delete that row, it will not return that data to datatables and thus datatables will not draw it.
fnDraw() is used a lot in the background of many of datatables action, like fnSort for example.