React-virtualized: re-rendering list

Created on 12 Feb 2019  路  4Comments  路  Source: bvaughn/react-virtualized

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.

Most helpful comment

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.

All 4 comments

Hi! Any progress on this issue?

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?

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.

Hi @neemanjabu,
Great! Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

athorwall picture athorwall  路  4Comments

miraage picture miraage  路  4Comments

ellatrix picture ellatrix  路  3Comments

SBoudrias picture SBoudrias  路  3Comments

pkumar84 picture pkumar84  路  4Comments