fnReloadAjax and page jump

fnReloadAjax and page jump

sifuhallsifuhall Posts: 20Questions: 0Answers: 0
edited May 2010 in General
I have a link like this:
[code]
link
[/code]
We are using javascript: void(0) to prevent the page from jumping (as in this case it is near the bottom of the page) and it worked fine.

Recently we added a call to fnReloadAjax in the function raiseStyle that is called in the onclick event of the link, but it appears fnReloadAjax causes the page to jump back to the top.

Is there a way to prevent this so the user stays at the bottom of the page during the refresh?

In this case the height of the table is static so maybe we could use that to our advantage?

Replies

  • sifuhallsifuhall Posts: 20Questions: 0Answers: 0
    Looks like adding the height to the div is working
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Possibly the reason for this is that DataTables clears the table entirely and then added new data to the table when you call fnReloadAjax. This might make the browser 'jump' since there is nothing to display at the bottom of the page for a fraction of a second.

    Good to hear you've got a work around for this. Another option would be to record what 'scrollTop' is before calling fnReloadAjax, and then setting it back to what it was in a callback function once the table has fully loaded again.

    Allan
This discussion has been closed.