Added table row filtering based on value of filter input text field.
This commit is contained in:
parent
4ef2a77c25
commit
ed17b83aae
@ -117,6 +117,19 @@ for (let i = 0; i < file_links.length; ++i)
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
//// FILTERING
|
||||
|
||||
function filter(sub) {
|
||||
const table = document.getElementsByTagName("tbody")[0].children
|
||||
for (let j = 0; j < table.length; ++j)
|
||||
if (sub === "" || table[j].children[0].children[0].innerText.toLowerCase().indexOf(sub) != -1)
|
||||
table[j].classList.remove("hidden");
|
||||
else
|
||||
table[j].classList.add("hidden");
|
||||
}
|
||||
|
||||
document.getElementsByName("filter")[0].addEventListener("input", e => filter(e.target.value.toLowerCase()));
|
||||
|
||||
//// SORT BY COLUMN
|
||||
|
||||
const [thead_name, thead_date, thead_size] = document.getElementsByTagName('thead')[0]
|
||||
|
Loading…
Reference in New Issue
Block a user