0

I am trying to combine a custom CSS table with the react virtualized window scroller. I currently can get the table to display, but am having trouble figuring out how to combine styling to that table, or add any logic to the table rows.

 <WindowScroller>
    {({ height, isScrolling, onChildScroll, scrollTop }) => (

      <Table
        autoHeight
        width={1000}
        height={700}
        headerHeight={20}
        rowHeight={30}
        isScrolling={isScrolling}
        onScroll={onChildScroll}
        rowCount={table.length}
        scrollTop={scrollTop}
        rowGetter={({ index }) => table[index]}
      >
        <Column
          label='Item1'
          dataKey='item1'
          width={150}
        />
        <Column
          width={200}
          label='item2'
          dataKey='item2'
        />
        <Column
          width={200}
          label='item3'
          dataKey='item3'
        />
        <Column
          width={150}
          label='item4'
          dataKey='item4'
        />
        <Column
          width={200}
          label='item5'
          dataKey='item5'
        />
      </Table>

    )}
  </WindowScroller>

1 Answer 1

1

Definitely review the docs. You'll likely be passing both some type of style props and event props to the components - so you need to understand how those components define and accept those props. This is only possible by reviewing the documentation of the library.

EDIT:

Here are the propTypes for the <Table /> component:

https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md

You'll see that it accepts custom event handlers like onRowClick but also style props like rowStyle

Sign up to request clarification or add additional context in comments.

4 Comments

Is there more documentation then this github.com/bvaughn/react-virtualized/blob/master/docs/… for window scroller?
yes - see my edit - you don't want to style <WindowScroller /> itself, you want to style the components inside like the <Table /> right?
Christopher is correct. WindowScroller doesn't have any presentation layer. It just watches for "scroll" events and passes down scrollTop to whatever RV component it wraps. (That's why there aren't many props.)
Ok I got it working after reading the documentation. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.