1

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.

http://jsfiddle.net/xtremer360/9hreh/

2 Answers 2

1

Once you've done your ajax call you need to call this function:

http://datatables.net/plug-ins/api#fnReloadAjax

Sign up to request clarification or add additional context in comments.

4 Comments

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() } }
it'll be like oTable.fnReloadAjax(); you should have the datatable setup as a ver/object somewhere, usually when the thing is set up.
For some reason its not removing the row.
The js file that I am using to deal with the js is involved in the jsfiddle. Its called contentpages.js.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.