forked from schrodinger/fixed-data-table-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlexGrowExample.js
63 lines (57 loc) · 1.52 KB
/
FlexGrowExample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Copyright Schrodinger, LLC
*/
"use strict";
const FakeObjectDataListStore = require('./helpers/FakeObjectDataListStore');
const { TextCell, ColoredTextCell } = require('./helpers/cells');
const { Table, Column, Cell } = require('fixed-data-table-2');
const React = require('react');
class FlexGrowExample 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="firstName"
header={<Cell>First Name</Cell>}
cell={<TextCell data={dataList} />}
fixed={true}
width={100}
/>
<Column
columnKey="sentence"
header={<Cell>Sentence! (flexGrow greediness=2)</Cell>}
cell={<ColoredTextCell data={dataList} />}
flexGrow={2}
width={200}
/>
<Column
columnKey="companyName"
header={<Cell>Company (flexGrow greediness=1)</Cell>}
cell={<TextCell data={dataList} />}
flexGrow={1}
width={200}
/>
<Column
columnKey="lastName"
width={100}
header={<Cell>Last Name</Cell>}
cell={<TextCell data={dataList} />}
/>
</Table>
);
}
}
module.exports = FlexGrowExample;