Primary Menu

Refreshing data in jQuery DataTables

Allan Jardine’s DataTables is a very powerful and slick jQuery plugin for displaying tabular data. It has many features and can do most of what you might want. One thing that’s curiously difficult though, is how to refresh the contents in a simple way, so I for my own reference, and possibly for the benefit of others as well, here’s a complete example of one way if doing this:

I personally like jqGrid better. It is more powerful and feature-rich. And I have heard it has better performance (but that I don’t know). On the other hand DataTables is simpler to learn – but not for this apparently

Yes, but for some reason that did not work for me. When googling I found several others having the same problem and that’s why I wrote this post. Apparently it’s some combination of configuration options that causes the problems…

Thanks for the comment though, it may very well work for others having similar problems.

I’m afraid it’s very difficult to know what your problem is, all I know is that the above code works for me. I can only assume that you have copied something wrong or missed to replace an id or something like that. Have you had a look at your browser’s script console? Any errors that occur should be displayed there.

Mad props to you Emil, you really helped me out.
I’d like to add just the following:
If you’re using jQuery instead of $ just add jQuery.noConflict() at the beggining of your javascript code; then replace $ by jQuery, as it is shown below: