Clear Selection button

main
Ryan Rix 2017-07-03 23:00:16 -05:00
parent 7421e82b82
commit a57280088b
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
var cacheEnabled = true;
var updateCache = function() {
var persistCache = function() {
if (cacheEnabled) {
window.localStorage.setItem('cache', cache);
}
@ -55,10 +55,17 @@ function toggleRow(e) {
} else {
setRowValue(id, true);
}
updateCache();
persistCache();
}
function updateHideUnselected() {
var table = document.getElementById('the_table');
table.className == "hide-unselected" ? table.className = "" : table.className = "hide-unselected";
}
function clearSelection() {
for (var i=1; i<=cache.length; i++) {
setRowValue(i, false);
}
persistCache();
}

View File

@ -22,6 +22,8 @@
<label for="showToggle">Hide unselected</label>
<input type="checkbox" id="showToggle" onchange="updateHideUnselected()">
<button id="clearSelection" onclick="clearSelection()">Clear Selection</button>
<table id="the_table">
<tr>
<th scope="col">Time & Estimate</th>