-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.html
201 lines (192 loc) · 6.52 KB
/
table.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Disrupt - score table</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css">
<!-- <style type="text/css">
table {
top: 10%;
left: 10%;
right: 10%;
}
</style> -->
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<ul class="nav">
<li class="nav-item">
<a class="nav-link active" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Overall scores</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Ethiopia scores</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Mozambique scores</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Bangladesh scores</a>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3 align="center">
Overall scores
</h3>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table
data-toggle="table"
data-search="true"
data-custom-search="customSearch"
data-url="js/data_all.json">
<thead>
<tr>
<th data-sortable="true" data-field="Innovation">Innovation</th>
<th data-sortable="true" data-field="Cluster">Cluster</th>
<th data-sortable="true" data-field="freq" data-cell-style="cellStyleF">Frequency</th>
<th data-sortable="true" data-field="Number Context">Contexts</th>
<th data-sortable="true" data-field="Nutrition_total" data-cell-style="cellStyleN">Nutrition score</th>
<th data-sortable="true" data-field="Planet_total" data-cell-style="cellStyleP">Planet score</th>
<th data-sortable="true" data-field="LEAPFROGGING" data-cell-style="cellStyleL">Leapfrogging score</th>
<th data-sortable="true" data-field="EQUITY" data-cell-style="cellStyleE">Equity score</th>
<th data-sortable="true" data-field="score_9" data-cell-style="cellStyleO">Overall score</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
<script>
$(function() {
$('#table').bootstrapTable({
formatSearch: function () {
return 'Search Innovations'
}
})
})
function customSearch(data, text) {
return data.filter(function (row) {
return row.Innovation.indexOf(text) > -1
})
}
</script>
<script>
function cellStyleF(value, row, index) {
var median = ['5.000000','2.000000','3.00000','3.120000','0.670000','0.620000','49.120000']
console.log(row)
if (value < median[0]) {
return {
css: {
"color": 'red'
}
}
}
return {
css: {
color: 'black'
}
}
}
function cellStyleN(value, row, index) {
var median = ['5.000000','2.000000','3.00000','3.120000','0.670000','0.620000','49.120000']
console.log(row)
if (value < median[2]) {
return {
css: {
"color": 'red'
}
}
}
return {
css: {
color: 'black'
}
}
}
function cellStyleP(value, row, index) {
var median = ['5.000000','2.000000','3.00000','3.120000','0.670000','0.620000','49.120000']
console.log(row)
if (value < median[3]) {
return {
css: {
"color": 'red'
}
}
}
return {
css: {
color: 'black'
}
}
}
function cellStyleL(value, row, index) {
var median = ['5.000000','2.000000','3.00000','3.120000','0.670000','0.620000','49.120000']
console.log(row)
if (value < median[4]) {
return {
css: {
"color": 'red'
}
}
}
return {
css: {
color: 'black'
}
}
}
function cellStyleE(value, row, index) {
var median = ['5.000000','2.000000','3.00000','3.120000','0.670000','0.620000','49.120000']
console.log(row)
if (value < median[5]) {
return {
css: {
"color": 'red'
}
}
}
return {
css: {
color: 'black'
}
}
}
function cellStyleO(value, row, index) {
var median = ['5.000000','2.000000','3.00000','3.120000','0.670000','0.620000','49.120000']
console.log(row)
if (value < median[6]) {
return {
css: {
"color": 'red'
}
}
}
return {
css: {
color: 'black'
}
}
}
</script>
</body>
</html>