react-virtualized icon indicating copy to clipboard operation
react-virtualized copied to clipboard

re-rendering list

Open VikrantShirvankar opened this issue 6 years ago • 6 comments

hi, I am using virtualized with react-sortable-hoc. I have used Masonry component to display data. but when i drag and drop elements, data is re-rendering and scroll going on the top. how do i maintain scroll even if data is re-rendered? is there any way to set startIndex? also scroll to position is not available in Masonry.

VikrantShirvankar avatar Feb 12 '19 10:02 VikrantShirvankar

Hi! Any progress on this issue?

HtmlRanger avatar Feb 19 '19 06:02 HtmlRanger

Hi, See this example - https://codesandbox.io/s/ovz73vwn26 When i move 1st item to the last item, scroll does not maintain its position, it goes on top. how to fix this issue?

VikrantShirvankar avatar Feb 19 '19 08:02 VikrantShirvankar

Hi @VikrantShirvankar, the issue here is recreating cache, cellPositioner and entire Masonry on each rerender, which causes complete Masonry to be rerendered and therefore scroll is set to initial top position. Just move those functions out of the render method in Child component. Working example: https://codesandbox.io/s/virtualized-sortable-450ii Hope this helps.

neemanjabu avatar Jul 11 '19 23:07 neemanjabu

Hi @neemanjabu, Great! Thanks.

VikrantShirvankar avatar Jul 12 '19 07:07 VikrantShirvankar

I also encountered this issue, but the example at https://codesandbox.io/s/virtualized-sortable-450ii can't be accessed anymore. Could you please repost the solution?

yaowangmx avatar Dec 15 '23 07:12 yaowangmx

We are having the same issue. Does anyone have the solution?

AdamZaczek avatar Apr 21 '24 11:04 AdamZaczek