-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
79 lines (73 loc) · 3.57 KB
/
index.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<html>
<head>
<meta charset="utf-8" />
<title>Acho Interview Project</title>
<script type="text/javascript" src="./js/jquery-3.6.0.js"></script>
<script type="text/javascript" src="./js/papaparse.min.js"></script>
<script type="text/javascript" src="./js/ScrollBar_sim.js" > </script>
<script type="text/javascript" src="./js/Renderer.js" > </script>
<link href="./css/style.css" rel="stylesheet" type="text/css"/>
<script type = "text/javascript">
var cellSize = {height : 40, width : 120};
$.ajax({
url: "acho_export_virtual_scroll.csv",
type: 'GET',
dataType: 'text',
cors: true ,
headers: {
'Access-Control-Allow-Origin': '*'
}
}).done(successFunction);
function successFunction(csv){
let results = Papa.parse(csv)
let headers = results.data[0];
let data = results.data.slice(1);
let vs = new VirtualScroller(headers, data);
vs.table.addEventListener("wheel", bindWheel);
window.addEventListener("mouseup", remmoveListener)
function bindWheel(e){
if (e.deltaY > 0){
vs.verticalBar.wheelMoveHandler(1);
}else{
vs.verticalBar.wheelMoveHandler(-1);
}
e.preventDefault();
}
function remmoveListener(e){
vs.verticalBar.remmoveListenerHander(e);
vs.horizontalBar.remmoveListenerHander(e);
}
}
class VirtualScroller{
constructor(headers, data){
this.table = document.getElementById("table");
this.tableHeader = document.getElementById("tableHeader");
this.tableContainer = document.getElementById("tableContainer");
this.headers = headers;
this.data = data;
this.usingCache = false;
this.containerSize = {width: tableContainer.offsetWidth, height: tableContainer.offsetHeight};
this.renderer = new Renderer(data, headers, tableContainer, tableHeader, cellSize, this.usingCache);
this.verticalBar = new ScrollBar01("\#verticalBar",
this.renderer, true, cellSize, this.usingCache);
this.horizontalBar = new ScrollBar01("\#horizontalBar",
this.renderer, false, cellSize, this.usingCache);
}
}
</script>
</head>
<body>
<div id="table">
<div id = "tableHeader"></div>
<div id = "tableContainer" style="top:40px;"></div>
<div id = "verticalBar" class = "scrollBar"
style="left: 1010px; top:40px; height: 600px; width: 20px;">
<div id = "verticalTicker" class = "ticker" style="width: 30px; height: 20px;"></div>
</div>
<div id = "horizontalBar" class = "scrollBar"
style="left: 0px; top: 640px; height: 20px; width: 1010px;" >
<div id = "horizontalTicker" class = "ticker" style="width: 20px; height: 20px;"></div>
</div>
</div>
</body>
</html>