how to disable virtual scrolling in slickgrid?

51 Views Asked by At

as title said, I want to capture all html element to generate a snapshot,but slickgrid use virtual scrolling, I got only several rows in viewport, when I scroll down, it shows blank

I need get all row dom to generate static html

1

There are 1 best solutions below

1
ghiscoding On BEST ANSWER

I previously wrote in the comment that you cannot disable virtual scrolling, however I was wrong since I forgot that you can actually disable it by using autoHeight: true, see Example 11 autoHeight

However, there are big limitations, or at least important notes, to know about:

  • using autoHeight means that it will create a div element for every single dataset row. If you have thousands of rows, this will make your DOM tree very large and can choke your browser and make is irresponsive, which is why virtual scrolling exist.
  • also using this flag will move the scrolling from the grid to the browser scroll, it's not much an issue but it's noteworthy

So can you disable virtual scrolling? The answer is Yes with autoHeight but be aware of the consequences. If you have less than a thousand rows then that might be acceptable, however with over a thousand rows it's probably better to keep the virtual scrolling enabled.