Skip to content

Commit 513fee2

Browse files
committed
table filtering
1 parent b6c06c6 commit 513fee2

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tagging-status/full.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The values in the *Status* column have the following meaning:
3838

3939
Click on the column headings to sort the table by the chosen column.
4040

41+
<input type="text" id="inp" onkeyup="filterrows()" placeholder="Seach terms">
4142

4243
<table class="sortable" style="display:table ;width:100%;position:absolute; left:0">
4344
<thead>
@@ -170,3 +171,23 @@ Other:
170171
<p id="ref{{r.number}}"><span>{{r.number}}. </span> <a href="{{r.url}}"><span>{{r.authors}}.</span> <span>{{r.title}}</span></a></p>
171172
{% endfor %}
172173

174+
<script>
175+
function filterrows() {
176+
const input = document.getElementById("inp");
177+
const filter = input.value.toUpperCase().split(' ');
178+
const table = document.getElementById("tbl");
179+
const tr = table.getElementsByTagName("tr");
180+
181+
// Loop through all table rows, and hide those who don't match all terms the search query
182+
for (let i = 0; i != tr.length; i++) {
183+
txtValue = tr[i].textContent.toUpperCase();
184+
let d="";
185+
for (let j=0;j!=filter.length;j++){
186+
if (txtValue.indexOf(filter[j]) == -1) {
187+
d="none";
188+
}
189+
}
190+
tr[i].style.display = d;
191+
}
192+
}
193+
</script>

0 commit comments

Comments
 (0)