Skip to content

Commit

Permalink
feat(web): add select all/none for columns
Browse files Browse the repository at this point in the history
Continued the work started with pull request jef#183
  • Loading branch information
lambia committed Dec 10, 2021
1 parent 72140be commit 7af8132
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<html>
<head>
<title>streetmerchant control</title>
<style>
table th {
cursor: pointer;
}
</style>
<script type="text/javascript">
let config;
let brands;
Expand Down Expand Up @@ -135,15 +140,26 @@

await loadScreenshots();
}

function selectAll(element, columnId) {
const list = document.querySelectorAll("#"+columnId+" input");
const checked = [...list].filter( el => el.checked ).length;
const newValue = (checked==list.length) ? false : true;

for (const htmlElement of list) {
htmlElement.checked = newValue;
}
}

</script>
</head>
<body onload="loadInitial();">
<table>
<tr>
<th>Stores</th>
<th>Brands</th>
<th>Series</th>
<th>Models</th>
<th onclick="selectAll(this, 'storeList');">Stores</th>
<th onclick="selectAll(this, 'brandList');">Brands</th>
<th onclick="selectAll(this, 'seriesList');">Series</th>
<th onclick="selectAll(this, 'modelList');">Models</th>
</tr>
<tr>
<td valign="top" id="storeList"></td>
Expand Down

0 comments on commit 7af8132

Please sign in to comment.