aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2020-12-03 14:13:55 -0600
committerzsloan2020-12-03 14:13:55 -0600
commite087a5ed176d3e935ca15c7d066b026dec653a6f (patch)
treec10a13565d0eb04de5163b58f81d1b4524f07bbc /wqflask
parentf90ae0eb938b48a6467223d44816d9b6522280cf (diff)
downloadgenenetwork2-e087a5ed176d3e935ca15c7d066b026dec653a6f.tar.gz
Changed invert function to use DataTables API so it can also work with Scroller
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js34
1 files changed, 19 insertions, 15 deletions
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index 3319d2cb..5e8277b3 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -31,21 +31,25 @@ $(function() {
};
invert = function() {
- $(".trait_checkbox").each(function() {
- if ($(this).prop('checked') == true) {
- $(this).prop('checked', false)
- }
- else {
- $(this).prop('checked', true)
- }
-
- if ($(this).closest('tr').hasClass('selected')) {
- $(this).closest('tr').removeClass('selected')
- }
- else {
- $(this).closest('tr').addClass('selected')
- }
- });
+ table_api = $('#trait_table').DataTable();
+
+ check_cells = table_api.column(0).nodes().to$();
+ for (let i = 0; i < check_cells.length; i++) {
+ if (check_cells[i].childNodes[0].checked){
+ check_cells[i].childNodes[0].checked = false;
+ } else {
+ check_cells[i].childNodes[0].checked = true;
+ }
+ }
+
+ check_rows = table_api.rows().nodes();
+ for (let i =0; i < check_rows.length; i++) {
+ if (check_rows[i].classList.contains("selected")){
+ check_rows[i].classList.remove("selected")
+ } else {
+ check_rows[i].classList.add("selected")
+ }
+ }
};
$('#searchbox').keyup(function(){