forked from bvaughn/react-virtualized
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtable.js
58 lines (51 loc) · 1.27 KB
/
table.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
const NUM_COLUMNS = 40;
function rowGetter(params) {
return new Array(NUM_COLUMNS).fill('').map(function(_, index) {
return index;
});
}
var App = React.createClass({
render: function() {
const flexColumns = [];
for (var i = 0; i < NUM_COLUMNS; i++) {
flexColumns.push(
React.createElement(ReactVirtualized.Column, {
dataKey: i,
flexGrow: 1,
key: i,
width: 50,
}),
);
}
return React.createElement(ReactVirtualized.AutoSizer, null, function(
params,
) {
return React.createElement(
ReactVirtualized.Table,
{
height: params.height,
overscanRowCount: 0,
rowGetter,
rowHeight: 30,
rowCount: 1000,
width: params.width,
},
null,
flexColumns,
);
});
},
});
ReactDOM.render(React.createElement(App), document.querySelector('#mount'));
const testCase = createScrollingTestCase(
document.querySelector('.ReactVirtualized__Grid'),
);
const TestRunner = FpsMeasurer.TestRunner;
const testRunner = new TestRunner(testCase, 5);
document.body.addEventListener('click', function(event) {
if (testRunner.isRunning()) {
testRunner.stop();
} else {
testRunner.start();
}
});