0.9.10-2 • Published 4 years ago

virtualized-data-table v0.9.10-2

Weekly downloads
20
License
MIT
Repository
-
Last release
4 years ago

Build Status

Demo

Click here to see a demo of virtualized-data-table!

Basic Usage

installation

npm install virtualized-data-table --save

API

Virtualized Data Table has an interface based on Facebook's now deprecated fixed-data-table, but improves the performance (poor performance being the main reason for its deprecation) by basing the implementation on React Virtualized <Grid>.

It supports much of, but not all, markup supported by fixed-data-table. In particular, it supports the concept of a <Table> with <Column> children that have both a header and cell renderer based on a <Cell>. Here are a few modifications to the example shown on the front page of of fixed-data-table to support virtualized-data-table:

  <VirtualizedDataTable
    rowHeight={50}
    rowsCount={rows.length}
    width={5000}
    height={5000}
    headerHeight={50}>
    <Column
      header={<Cell>Col 1</Cell>}
      cell={<Cell>Column 1 static content</Cell>}
      width={2000}
    />
    <Column
      header={<Cell>Col 2</Cell>}
      cell={<MyCustomCell mySpecialProp="column2" />}
      width={1000}
    />
    <Column
      header={<Cell>Col 3</Cell>}
      cell={({rowIndex, columnKey, ...props}) => (
        <Cell {...props}>
          Data for column 3: {rows[rowIndex][columnKey]}
        </Cell>
      )}
      width={2000}
    />
  </Table>

It should also support Cell classes built for use with fixed-data-table, with a few modifications (see below).

This package could be a replacement for fixed-data-table in your project that could provide better performance than fixed-data-table with minimal code changes. That was the motivation for its creation. However, this package is not guaranteed to handle all possible use cases of fixed-data-table, so if this package doesn't provide support for your use case, feel free to add support for it!

Porting from fixed-data-table

In order to port your tables from fixed-data-table, you just need to add a few things:

1) You need to ensure each column has a 'columnKey' string property 2) You need to implement a rowGetter function as a property of your root Table which is passed a rowIndex and returns the data for that entire row. 3) Your custom cells or cell handlers will be passed an object containing 'rowData' (obtained from rowGetter), as well as the rowIndex and columnKey where the cell is being rendered

That should be it! Once you change your table and cell classes to handle columnKeys and rowData, everything should "just work."

Additional features

Some features were implemented beyond those which were supported by fixed-data-table (documentation to be provided soon):

1) Table column resizability 2) Row/column selectability 3) Group headers (another header that can span multiple columns) 4) Copy/paste support (Google sheets-esque) 5) Ability to freeze lefthand columns and scroll other columns

(c)2017 Raycom Media, Inc. Released under the MIT license.

MIT

0.9.10-2

4 years ago

0.9.10-1

5 years ago

0.9.10

5 years ago

0.9.9-43

5 years ago

0.9.9-42

5 years ago

0.9.9-41

5 years ago

0.9.9-40

5 years ago

0.9.9-39

5 years ago

0.9.9-38

5 years ago

0.9.9-37

5 years ago

0.9.9-36

6 years ago

0.9.9-35

6 years ago

0.9.9-34

6 years ago

0.9.9-33

6 years ago

0.9.9-32

6 years ago

0.9.9-31

6 years ago

0.9.9-3

6 years ago

0.9.9-2

6 years ago

0.9.9-1

6 years ago

0.9.9

6 years ago

0.9.8

6 years ago

0.9.7

6 years ago

0.9.6

6 years ago

0.9.5

6 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.1.0

6 years ago