forked from bvaughn/react-virtualized
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscroll-sync.js
59 lines (57 loc) · 1.58 KB
/
scroll-sync.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
function cellRenderer(params) {
return React.createElement(
'div',
{
className: 'item',
key: params.key,
style: params.style,
},
params.columnIndex,
);
}
var App = React.createClass({
render: function() {
return React.createElement(ReactVirtualized.AutoSizer, null, function(
autoSizerParams,
) {
return React.createElement(ReactVirtualized.ScrollSync, null, function(
scrollSyncParams,
) {
return React.createElement(
'div',
{
style: {
height: autoSizerParams.height,
width: autoSizerParams.width,
},
},
React.createElement(ReactVirtualized.Grid, {
cellRenderer: cellRenderer,
columnCount: 1000,
columnWidth: 35,
height: autoSizerParams.height / 2,
key: 0,
overscanRowCount: 0,
rowHeight: 30,
rowCount: 5000,
scrollLeft: scrollSyncParams.scrollLeft,
width: autoSizerParams.width,
}),
React.createElement(ReactVirtualized.Grid, {
cellRenderer: cellRenderer,
columnCount: 1000,
columnWidth: 35,
height: autoSizerParams.height / 2,
key: 1,
overscanRowCount: 0,
onScroll: scrollSyncParams.onScroll,
rowHeight: 30,
rowCount: 5000,
width: autoSizerParams.width,
}),
);
});
});
},
});
ReactDOM.render(React.createElement(App), document.querySelector('#mount'));