Autodesk / Autodesk/react-base-table

Making react-base-table work with array data

Open
#251 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

Thank you for making this wonderful library. I've added it to my JavaScript grid library comparison page, https://jsgrids.statico.io/, and used it on a new tool I'm building to work with CSV files, which you can see in action here: https://csvhacker.statico.io/#url:%27https://csv.statico.io/10k.csv%27

For performance purposes, I want my data to be arrays of arrays, so I needed to tweak react-base-table so that it would assign React `key` properties correctly and not complain about violating prop types. Those hacks are here: https://github.com/statico/csvhacker/commit/4322b94d45497e86e3d66a7ead9b694979342275

```import TableRow from "react-base-table/es/TableRow"
TableRow.propTypes.rowData = PropTypes.array
import TableCell from "react-base-table/es/TableCell"
TableCell.propTypes.rowData = PropTypes.array
import GridTable from "react-base-table/es/GridTable"
GridTable.prototype._itemKey = ({ rowIndex }) => String(rowIndex)
```

It would be wonderful if react-base-table supported array data more easily, but I would understand if such functionality is out of scope.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.