2

I have a table with react-table v7. Have used react-window for virtualisation. Now the table has last column fixed but I am unable to fix the last column of the table. React-window's internal element has overflow: auto which is not letting the column to be sticky at last.

Here's the link reproduce the issue.

I am trying to achieve something around these lines.

If you see the issue link, I want the last row to be fixed at a position and keep the rest horizontally scrollable.

priyanshu sinha
  • 595
  • 6
  • 14

4 Answers4

2

For sticky header you should implement innerElementType props as react-window said like this.

But for sticky column maybe more standard way of that is to use another grid or list beside that and sync their scroll position like this one.

you could also use react-base-table which implement whole side sticky rows and columns.

Lord Pooria
  • 522
  • 6
  • 14
1

I encountered this exact same issue. I came up with a solution that:

  1. Add a className to the <FixedSizeList className={styles.fixedList} ...>
  2. Add css to override the scroll: .fixedList { overflow: unset !important; }

Once I did this, it allowed my sticky column to be 'sticky' again. I hope this helps you as well.

Jason Neal
  • 11
  • 3
  • Doesnt work, as you then cant scroll, due to the dependence of overflow:hidden - Or at least, that's what im experiencing... Do you have an example of this where it works with sticky columns and scroll still working? – envy Nov 09 '20 at 20:55
0

Sticky columns and rows could be implemented by using innerElementType property of FixedSizeList provided by react-window.

Here's a working example:

https://codesandbox.io/s/dazzling-field-48x39?file=/src/App.tsx

0

Hi I created this reusable react component

  • it uses only react-window with custom sticky columns implementation
  • i have lot of columns so i need column virtualization too

https://codesandbox.io/s/react-window-sticky-grid-forked-kkcf2z?file=/src/CustomVirtualGrid.js

enter image description here

Mohsin Ejaz
  • 316
  • 3
  • 7