From 77e4b248b376e8a93612a8911f7a443ea7f99dfc Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 24 Feb 2025 16:57:18 -0600 Subject: Enable selecting specific rows. --- uploader/static/js/datatables.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 uploader/static/js/datatables.js (limited to 'uploader/static/js/datatables.js') 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()); + } + }); + }); +}); -- cgit v1.2.3