fixed-data-table-one.com
Version:
A React table component designed to allow presenting thousands of rows of data.
87 lines (80 loc) • 2.12 kB
JavaScript
/**
* Copyright Schrodinger, LLC
*/
;
const FakeObjectDataListStore = require('./helpers/FakeObjectDataListStore');
const { DateCell, ImageCell, LinkCell, TextCell } = require('./helpers/cells');
const { Table, Column, Cell } = require('fixed-data-table-2');
const React = require('react');
class ObjectDataExample extends React.Component {
constructor(props) {
super(props);
this.state = {
dataList: new FakeObjectDataListStore(1000000),
};
}
render() {
var {dataList} = this.state;
return (
<Table
rowHeight={50}
headerHeight={50}
rowsCount={dataList.getSize()}
width={1000}
height={500}
{...this.props}>
<Column
columnKey="avatar"
cell={<ImageCell data={dataList} />}
fixed={true}
width={50}
/>
<Column
columnKey="firstName"
header={<Cell>First Name</Cell>}
cell={<LinkCell data={dataList} />}
fixed={true}
width={100}
/>
<Column
columnKey="lastName"
header={<Cell>Last Name</Cell>}
cell={<TextCell data={dataList} />}
fixed={true}
width={100}
/>
<Column
columnKey="city"
header={<Cell>City</Cell>}
cell={<TextCell data={dataList} />}
width={100}
/>
<Column
columnKey="street"
header={<Cell>Street</Cell>}
cell={<TextCell data={dataList} />}
width={200}
/>
<Column
columnKey="zipCode"
header={<Cell>Zip Code</Cell>}
cell={<TextCell data={dataList} />}
width={200}
/>
<Column
columnKey="email"
header={<Cell>Email</Cell>}
cell={<LinkCell data={dataList} />}
width={200}
/>
<Column
columnKey="date"
header={<Cell>DOB</Cell>}
cell={<DateCell data={dataList} />}
width={200}
/>
</Table>
);
}
}
module.exports = ObjectDataExample;