scrollY + adding a row scrolls back to top (ordering rows after insert)
scrollY + adding a row scrolls back to top (ordering rows after insert)
I have a fixed amount of rows (e.g. 75). Sometimes some of these are updated, sometimes some of these are removed and then a new one is added (remove and add before calling draw()). I use scrollY with a fixed pixel size. I need that the rows don't "jump" around whenever a new one is added, I guess this happens because i let dataTables order the rows automatically?
Is there any solution to this problem?
Note: I guess it works when ordering is disabled, so in the worst case I could disable ordering, and do it manually, then insert the row at the desired position?
This question has an accepted answers - jump to answer
Answers
You should be able to use
draw(false)
to stay on the current page. Please see thedraw()
docs.Kevin
Thank you, that seems to work so far for my first tests.
Though I don't have pagination (just using scrollY), so the docs description is a bit misleading.