about summary refs log tree commit diff
diff options
context:
space:
mode:
authoruditgulati2020-09-06 10:38:19 -0500
committeruditgulati2020-11-01 06:47:02 -0600
commitaa2d7a45fca8c6503a5de6cec7ce58d248144b9d (patch)
treeaf47c3b792ce74440b24c9961a6511329bbc966a
parentdfdff4934e423e2f4f626625a8bd1f45a64187b4 (diff)
downloadgenenetwork2-aa2d7a45fca8c6503a5de6cec7ce58d248144b9d.tar.gz
add row highlight on checkbox checked state
-rw-r--r--wqflask/wqflask/static/new/css/snp_browser.css4
-rw-r--r--wqflask/wqflask/templates/snp_browser.html17
2 files changed, 19 insertions, 2 deletions
diff --git a/wqflask/wqflask/static/new/css/snp_browser.css b/wqflask/wqflask/static/new/css/snp_browser.css
index 1dd332cb..a7942d2a 100644
--- a/wqflask/wqflask/static/new/css/snp_browser.css
+++ b/wqflask/wqflask/static/new/css/snp_browser.css
@@ -6,6 +6,10 @@ table.dataTable thead th {
   vertical-align: bottom;
 }
 
+table.dataTable tbody tr.selected {
+  background-color: #ffee99;
+}
+
 table.dataTable thead .sorting,
 table.dataTable thead .sorting_asc,
 table.dataTable thead .sorting_desc,
diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html
index 435a521c..c312aee8 100644
--- a/wqflask/wqflask/templates/snp_browser.html
+++ b/wqflask/wqflask/templates/snp_browser.html
@@ -283,7 +283,7 @@
           'className': 'dt-body-center',
           'orderable': false,
           'render': function(data, type, row, meta) {
-            return '<input type="checkbox" name="trait_check">'
+            return '<input type="checkbox" class="checkbox" id="variant_checkbox" onchange="onVarinatCheck(this)" name="trait_check">'
           }
         }, {
           'data': 'index',
@@ -396,7 +396,7 @@
         {
           'data': null,
           'render': function(data, type, row, meta) {
-            return '<input type="checkbox" name="trait_check">'
+            return '<input type="checkbox" class="checkbox" id="variant_checkbox" onchange="onVarinatCheck(this)" name="trait_check">'
           }
         }, {
           'data': 'index',
@@ -437,6 +437,19 @@
     });
     {% endif %}
 
+    function onVarinatCheck(checkboxElem) {
+        if (checkboxElem.checked) {
+            if (!checkboxElem.parentElement.parentElement.classList.contains('selected')) {
+                checkboxElem.parentElement.parentElement.classList.add('selected')
+            }
+        }
+        else {
+            if (checkboxElem.parentElement.parentElement.classList.contains('selected')) {
+                checkboxElem.parentElement.parentElement.classList.remove('selected')
+            }
+        }
+    }
+
     $("#species_select").change(function() {
         this_species = $(this).val();
         $("#strain_select").empty()