React-Virtualized keep floating Table header inside WindowScroller

Viewed 89

The documentation for WindowScroller in React-Virtualized (https://github.com/bvaughn/react-virtualized/blob/master/docs/WindowScroller.md) suggests that it is compatible with the Table and the below code does sort of work

        <WindowScroller>
            {({ height, isScrolling, registerChild, scrollTop }) => (
                <AutoSizer disableHeight>
                    {({ width }) => (
                        <div ref={registerChild}>
                            <Table
                                autoHeight
                                isScrolling={isScrolling}
                                scrollTop={scrollTop}
                                height={height}

                                width={Math.max(width, 700)}
                                headerHeight={20}
                                rowHeight={30}
                                rowCount={warps.length}
                                rowGetter={({ index }) => warps[index]}
                            >
                                <Column
                                    dataKey="one"
                                    label="One"
                                    width={100}
                                />
                                <Column
                                    dataKey="two"
                                    label="Two"
                                    width={50}
                                />
                            </Table>
                        </div>
                    )}
                </AutoSizer>

but the table header is now no longer floating above the table as was the case without WindowScroller. Is there any way that I can get this behavior back? I guess I could manually render the header outside the table, but that will be quite a hassle because I want to use flexGrow on the columns so I will not know their widths and would probably need to create a clone table with no rows for that?

0 Answers
Related