1

I've spent couple of weeks on building a datatables showing an uptodate information (about every 10 secs) from a server. I'm so close done but i think i hit a major problem - which is the underlying design on creating/using datatables could be totally wrong (sob!). Since i do not know how to put a print screen on stackoverflow, here is the summary in short:

  1. A JSP page send a request to a server every 10 secs.
  2. The response coming back from the server has the uptodate information.
  3. The response coming back is in XML form. The XML has table elements (with table id=snaptable). Basically a DHTML.
  4. The JSP page insert this XML (having table id=snaptable) into a DIV element in this page.
  5. Create a datatable based on this table id=snaptable.
  6. Repeat this every 10 secs - each time recreate the new table id=snaptable based on the new information from the response.

This works very well.

Here's the issue:
1. If i go the page 2, after 10 sec it automatically goes back to page 1
2. I think what happen here is since every new information comes in every 10 sec is a new instance of datatable (remember - i recreate a datatables every 10 secs), hence it automatically goes back to page 1.

What i want is if i'm in page 2 or page 3, i want to remain on that page while datatables get a refresh every 10 secs. I think i have a wrong design and feel awful due to all the effort i have put in. How to solve this in the shortest way?

Please advice. Thanks

1 Answer 1

1

You are not very informative (some source could be helpful :) but try add bStateSave to the DataTable creation, eg

var myTable = $('#myTable').dataTable( {
    "bStateSave": true
    ...
});

doc for bStateSave here http://www.datatables.net/ref#bStateSave

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

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.