We are using virtualized grid to display large data set under different tabs. and to do in more efficient way we have pagination and single grid being display in all the tabs and once user switch the tab we end up changing data set for column grid and as well for content grid.
we save the per tab scroll position state and get that reassigned to scrollToRow once user switches over the tab. Everything works fine.
Problem occurs when we move from page 1 to page 2[data is on client side so we just slice array and pass it to grid] in the same tab , scrollToRow is being to reset to zero every time but grid does not reset scroll position w.r.t scrollToRow number (0).
is this the bug ? or i am missing something here?
You might be missing something, or it might be a bug. I have a lot of scrolling related unit tests but I overlook stuff sometimes.
Can you point me at a small repro of this? Plnkr or something?
thanks Brian, interestingly if i set scrollToRow to 1 on pagination it works. but not with zero.
@pkumar84 I think I've seen this before 鈥撀燼re you positive the value is changing between pages? If not you may need to call recomputeRowHeights or recomputeGridSize depending on which component you're using. I don't believe a re-render will be triggered if the props don't change.
@zsherman is correct. If shallowCompare doesn't see a change (in props) then nothing will re-render _unless_ explicitly told to via forceRender (or similar).
Try explicitly setting scrollToRow to undefined before setting it back to 0 (or whatever) and see if that changes behavior for you.
My bad, i don't save tab grid scroll position state unless user switch over the tab, so during this case scrollToRow was always zero. so end up toggling between 0 and null helps me out to reset scroll position. thanks and sorry for in-convince .
Been there, glad you figured it out!