From 04ef9ee2f18e812b4a24d478bdbf78303923623e Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 27 Jan 2022 19:40:54 +0000 Subject: 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 --- .../wqflask/static/new/javascript/search_results.js | 19 +++++++++++++------ 1 file 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){ -- cgit v1.2.3