aboutsummaryrefslogtreecommitdiff
path: root/uploader
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-02-24 16:57:18 -0600
committerFrederick Muriuki Muriithi2025-02-24 16:57:18 -0600
commit77e4b248b376e8a93612a8911f7a443ea7f99dfc (patch)
tree008e3271cd41395ecb6cfffc9f6acf673cc3ebe3 /uploader
parent076b148d876f373ffdf98cabe91cddf47288daeb (diff)
downloadgn-uploader-77e4b248b376e8a93612a8911f7a443ea7f99dfc.tar.gz
Enable selecting specific rows.
Diffstat (limited to 'uploader')
-rw-r--r--uploader/static/js/datatables.js18
-rw-r--r--uploader/templates/base.html1
2 files changed, 19 insertions, 0 deletions
diff --git a/uploader/static/js/datatables.js b/uploader/static/js/datatables.js
new file mode 100644
index 0000000..586ef30
--- /dev/null
+++ b/uploader/static/js/datatables.js
@@ -0,0 +1,18 @@
+/** Handlers for events in datatables **/
+
+$(() => {
+ $("#tbl-phenotypes-list").on("draw.dt", () => {
+ $(".chk-row-select").on("change", (event) => {
+ var checkbox = event.target;
+ var tablerow = checkbox.parentElement.parentElement;
+ var tableclass = tablerow.getAttribute("class");
+ if(checkbox.checked) {
+ tablerow.setAttribute("class", `${tableclass} selected`);
+ }
+ else {
+ tablerow.setAttribute(
+ "class", tableclass.replace("selected", "").trim());
+ }
+ });
+ });
+});
diff --git a/uploader/templates/base.html b/uploader/templates/base.html
index 5eca445..6003e68 100644
--- a/uploader/templates/base.html
+++ b/uploader/templates/base.html
@@ -134,6 +134,7 @@
<script type="text/javascript"
src="{{url_for('base.datatables',
filename='js/jquery.dataTables.js')}}"></script>
+ <script type="text/javascript" src="/static/js/datatables.js"></script>
{%block javascript%}{%endblock%}
</body>
</html>