about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzsloan2022-01-27 19:40:54 +0000
committerzsloan2022-01-27 13:45:09 -0600
commit04ef9ee2f18e812b4a24d478bdbf78303923623e (patch)
treee6b606bab93d15bcd382bbf9867558743f5e10ec
parent63cfd61c030312158aba242ff239e79e2025f2e0 (diff)
downloadgenenetwork2-04ef9ee2f18e812b4a24d478bdbf78303923623e.tar.gz
Highlight rows selected by filterByIndex
This adds the "selected" class to rows selected by filterByIndex, which adds highlighting to them
I also made the variables in this part of the code camel cased
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index c5f9fe00..ff2452af 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -132,16 +132,23 @@ $(function() {
   }
 
   filterByIndex = function() {
-    index_string = $('#select_top').val()
-    index_set = parseIndexString(index_string)
+    indexString = $('#select_top').val()
+    indexSet = parseIndexString(indexString)
 
-    table_api = $('#trait_table').DataTable();
-    check_nodes = table_api.column(0).nodes().to$();
-    check_nodes.each(function(index) {
-      if (index_set.has(index + 1)){
+    tableApi = $('#trait_table').DataTable();
+    checkNodes = tableApi.column(0).nodes().to$();
+    checkNodes.each(function(index) {
+      if (indexSet.has(index + 1)){
         $(this)[0].childNodes[0].checked = true
       }
     })
+
+    checkRows = tableApi.rows().nodes().to$();
+    checkRows.each(function(index) {
+      if (indexSet.has(index + 1)){
+        $(this)[0].classList.add("selected");
+      }
+    })
   }
 
   $(window).keydown(function(event){