Spaces:
Running
Running
Update index.html
Browse files- index.html +17 -0
index.html
CHANGED
|
@@ -114,6 +114,8 @@
|
|
| 114 |
<select id="metricFilter">
|
| 115 |
<option value="">All</option>
|
| 116 |
</select>
|
|
|
|
|
|
|
| 117 |
</div>
|
| 118 |
<div class="table-container">
|
| 119 |
<table id="csvTable">
|
|
@@ -179,6 +181,21 @@
|
|
| 179 |
const tableBody = table.querySelector('tbody');
|
| 180 |
const overlay = document.getElementById('overlay');
|
| 181 |
const modal = document.getElementById('modal');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
function makeResizable() {
|
| 183 |
const thElements = document.querySelectorAll('th');
|
| 184 |
thElements.forEach(th => {
|
|
|
|
| 114 |
<select id="metricFilter">
|
| 115 |
<option value="">All</option>
|
| 116 |
</select>
|
| 117 |
+
<h2>Filter Table by Name</h2>
|
| 118 |
+
<input type="text" id="searchInput" placeholder="Search for names..." style="margin-bottom: 10px; padding: 8px; width: 100%;">
|
| 119 |
</div>
|
| 120 |
<div class="table-container">
|
| 121 |
<table id="csvTable">
|
|
|
|
| 181 |
const tableBody = table.querySelector('tbody');
|
| 182 |
const overlay = document.getElementById('overlay');
|
| 183 |
const modal = document.getElementById('modal');
|
| 184 |
+
|
| 185 |
+
document.getElementById('searchInput').addEventListener('input', function () {
|
| 186 |
+
const filter = this.value.trim().toLowerCase(); // Normalize input
|
| 187 |
+
const table = document.getElementById('csvTable');
|
| 188 |
+
const rows = table.querySelectorAll('tbody tr');
|
| 189 |
+
|
| 190 |
+
rows.forEach(row => {
|
| 191 |
+
const nameCell = row.cells[1];
|
| 192 |
+
if (nameCell) {
|
| 193 |
+
const name = nameCell.textContent.trim().toLowerCase();
|
| 194 |
+
row.style.display = name.includes(filter) ? '' : 'none';
|
| 195 |
+
}
|
| 196 |
+
});
|
| 197 |
+
});
|
| 198 |
+
|
| 199 |
function makeResizable() {
|
| 200 |
const thElements = document.querySelectorAll('th');
|
| 201 |
thElements.forEach(th => {
|