Scrollbar position and state saving

Scrollbar position and state saving

marianopeckmarianopeck Posts: 53Questions: 8Answers: 0
edited October 2013 in DataTables 1.9
Hi guys.

My webapp in which I am using DataTables is very server side. I only render the table + DataTables in the client. In all my tables, I have a first column which is a checkbox to select/unselect rows. Say I have a table with vertical scroll. If I have scrolled up to the middle of the table, and I click on the checkbox to select the row, that is a request...so when it is rendered again, I come back to the top of the table.... of course.
So I was thinking.... does DataTables has something to offer me to solve this issue? Maybe there is something I can do with the state saving?

Thanks!

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Currently the state saving and DataTables core does not remember the scroll position. However, the Scroller extra does, which might be an option for you?

    Allan
  • marianopeckmarianopeck Posts: 53Questions: 8Answers: 0
    Hi Allan. Scroller is not an option for me. Kind of complicate to explain, but I do have table controls before my HTML table so when scrolling down, I need to have not only the table always visible but also that div with the controls...and some other reasons. because of that, what I do need is to keep the header always visible, which DataTables does!! :) So I am using DataTables + FixedColumns which I also need.

    But...if you tell me where I can look in Scroller, if it is not too complex, I can try to adapt it to normal/regular DataTables or directly for my tables???

    I just need to fix all the alignment issues and I am ready to go to using DataTables in production :)

    Thanks very much for this project!
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    This is how Scroller does it: https://github.com/DataTables/Scroller/blob/master/media/js/dataTables.scroller.js#L422 . And https://github.com/DataTables/Scroller/blob/master/media/js/dataTables.scroller.js#L610 .

    Allan
This discussion has been closed.