olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.75k stars 818 forks source link

Sorting large tables causes them to be blank until scrolled #3586

Closed purxiz closed 2 years ago

purxiz commented 2 years ago

Describe the bug When sorting a table by clicking on a header/title, with enough rows (and a small enough height) that some aren't rendered (virtualDOM enabled), the table becomes blank.

Tabulator Info

Working Example This can be re-created using the first example on the "examples" page, titled Virtual DOM.

To Reproduce

  1. Go to tabulator examples
  2. In the first table, Virtual DOM - Vertical, scroll down about halfway
  3. Sort on any column by clicking on the header row
  4. Table either becomes blank, or scrolls all the way to the bottom.
  5. If table scrolls to the bottom, repeat from 2, and the table will become blank until scrolled again.

Expected behavior Either table maintains position and correctly renders rows, or as in 4.9, table always scrolls to the top when sorted on a column.

Screenshots image

Desktop (please complete the following information):

anthonyrobertson commented 2 years ago

I too see this happen with large tables. If I scroll down from the top of the table and then sort on any column, there are rendering issues with the table.

It only takes several hundred rows, maybe less. Sometimes the table will partially render which caused me to notice that the padding values seem to be miscalculated.

The workaround I'm using is to call a forced redraw() on the table when the dataSorted event happens which scrolls the table back to the top. This works for the time being, but it prevents me from updating a single row and then re-sorting with setSort() because that causes the rendering bug. Ideally I could update a single row, re-sort the table and have the user's scroll position preserved.

I am using 5.1 and also reproduced this on 5.0, MacOS / Chrome

Thank you for all your hard work on this excellent library

olifolkerd commented 2 years ago

Hey all,

I have pushed a fix for this to the master branch and will include it in this weekends patch release.

Cheers

Oli :)