Using anchor with form into datatable

Using anchor with form into datatable

kris40kris40 Posts: 7Questions: 2Answers: 0

Hello,

I made a datatable with a classic form (input field, submit button) on each line. When i validate the form, i would like the datatable to stay on the same line instead of going to the top of it. Is it possible to do that ? The page is reloaded when the form is validated, i use codeigniter framework and i have to add #myanchor at the end of the urlform to go to the named anchor, but it doesn't work here.
Even hard coded <a name="myanchor"></a> doesn't work, i'm still at the top of the page. But the url (in firefox) is good and when i clic and (re)enter the url it scrolls to my anchor as it should. Any ideas ?
Thanks a lot

Replies

  • allanallan Posts: 61,433Questions: 1Answers: 10,049 Site admin

    This is really a generic Javascript question rather than being specific to DataTables (even although you are using DataTables), so StackOverflow would probably be a better place for it.

    However, if the page is reloaded, rather than using Ajax, what you might have to do is save the scroll position into a localStorage variable and then read that back and jump to that point when the page is reloaded.

    I'm surprised that the anchor doesn't work on the form action URL though. Does it work if you don't use any Javascript?

    Allan

This discussion has been closed.