af-react-table. A Cool React virtual table.
npm install --save af-react-table
use-resize-observer
hookscrollToRow(rowIndex)
method is availablerowCountWarningsTable
propuseApi
can give table any table subcomponent access to global API@emotion
is used for styling, so you can pass css prop to table wrappertable
, tr
, td
, th
, so default table styling, border collapsing, etc. can be easily applied.Table.propTypes = {
columns: PropTypes.array.isRequired,
getRowData: PropTypes.func.isRequired,
rowCount: PropTypes.number,
getRowKey: PropTypes.func,
estimatedRowHeight: PropTypes.number,
getRowExtraProps: PropTypes.func,
/* as row heights may be different, we measure overscan in px */
overscanRowsDistance: PropTypes.number,
HeaderRowComponent: PropTypes.any,
RowComponent: PropTypes.any,
CellComponent: PropTypes.any,
RowCountWarningContainer: PropTypes.any,
rowCountWarningsTable: PropTypes.object,
fixedLayout: PropTypes.bool
};
Table.defaultProps = {
rowCount: 0,
estimatedRowHeight: 20,
overscanRowsDistance: 200,
fixedLayout: false,
/*
For 90% non-reactive solutions, which only provide new getRowData when data is changed, memo is ok.
If RowComponent should be wrapped my mobx observer - non-memo version should be imported.
memo(observer(RowComponentDefault)) will do the trick.
*/
RowComponent: memo( RowComponentDefault ),
CellComponent: CellComponentDefault,
RowCountWarningContainer: RowCountWarningContainerDefault,
};
Author: nowaalex
Live Demo: https://nowaalex.github.io/af-react-table/exampleAssets/
GitHub: https://github.com/nowaalex/af-react-table
#reactjs #javascript