-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_old.html
98 lines (89 loc) · 3 KB
/
index_old.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
<!DOCTYPE html>
<html>
<head>
<title>Competenze di Data Literacy</title>
<style>
table {
font-family: Arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
input[type="text"] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
}
</style>
</head>
<body>
<h1>Competenze di Data Literacy</h1>
<input type="text" id="searchInput" placeholder="Cerca competenza..." onkeyup="searchTable()">
<table id="competenzeTable">
<thead>
<tr>
<th>Numero progressivo competenza</th>
<th>Nome competenza</th>
<th>Livello</th>
<th>Descrizione</th>
<th>Cose fare per acquisirla</th>
</tr>
</thead>
<tbody>
<!-- I dati verranno caricati qui usando jQuery -->
</tbody>
</table>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function () {
// Carica i dati dal file CSV
$.get("competenze.csv", function (data) {
// Dividi il file CSV in righe
var lines = data.split("\n");
// Itera sulle righe del CSV (ignorando l'intestazione)
for (var i = 1; i < lines.length; i++) {
var line = lines[i].split(";");
var row = "<tr>";
for (var j = 0; j < line.length; j++) {
row += "<td>" + line[j] + "</td>";
}
row += "</tr>";
$("#competenzeTable tbody").append(row);
}
});
});
// Funzione per filtrare la tabella in base all'input dell'utente
function searchTable() {
var input, filter, table, tr, td, i, j, txtValue;
input = document.getElementById("searchInput");
filter = input.value.toUpperCase();
table = document.getElementById("competenzeTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
var displayRow = false;
td = tr[i].getElementsByTagName("td");
for (j = 0; j < td.length; j++) {
txtValue = td[j].textContent || td[j].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
displayRow = true;
break;
}
}
if (displayRow) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
</script>
</body>
</html>