-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from nhsengland/aib/80-review-of-our-members-t…
…able AIB review of our members table
- Loading branch information
Showing
5 changed files
with
150 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function tableFilter(table_id, input_id) { | ||
// Declare variables | ||
var input, filter, table, tr, td, i, txtValue; | ||
input = document.getElementById(input_id); | ||
filter = input.value.toUpperCase(); | ||
table = document.getElementById(table_id); | ||
tr = table.getElementsByTagName("tr"); | ||
const columnSelector = document.getElementById("columnToSearch").value; | ||
|
||
console.log(columnSelector) | ||
// Loop through all table rows, and hide those who don't match the search query | ||
const columnNames = ['Name','Role', 'Team', 'Github'] | ||
const columnIndex = columnNames.indexOf(columnSelector) | ||
|
||
for (i=0; i < tr.length; i++) { | ||
td = tr[i].getElementsByTagName("td")[columnIndex]; | ||
if (td) { | ||
txtValue = td.textContent || td.innerText; | ||
if (txtValue.toUpperCase().indexOf(filter) > -1) { | ||
tr[i].style.display = ""; | ||
} else { | ||
tr[i].style.display = "none"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
document$.subscribe(function() { | ||
var tables = document.querySelectorAll("article table:not([class])") | ||
tables.forEach(function(table) { | ||
new Tablesort(table) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,5 +80,8 @@ extra_javascript: | |
- javascripts/mathjax.js | ||
- https://polyfill.io/v3/polyfill.min.js?features=es6 | ||
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js | ||
- https://unpkg.com/[email protected]/dist/tablesort.min.js | ||
- javascripts/tablesort.js | ||
- javascripts/tablefilter.js | ||
watch: | ||
- overrides |