diff options
author | zsloan | 2020-12-03 17:09:51 -0600 |
---|---|---|
committer | zsloan | 2020-12-03 17:09:51 -0600 |
commit | c485dad44e531ea6a961b9bedf790eab248748dc (patch) | |
tree | b6856fbae78d601ba1e18945686df5032d7f2837 /wqflask | |
parent | 812e9e84ca98c13ba3e378b169dce235feef5c15 (diff) | |
download | genenetwork2-c485dad44e531ea6a961b9bedf790eab248748dc.tar.gz |
Fixed drawCallback JS to work correctly and removed change_buttons function since it's now in search_results.js
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/templates/search_result_page.html | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 8a467bfb..87c97c50 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -204,42 +204,21 @@ } }); - function change_buttons() { - buttons = ["#add", "#remove"]; - num_checked = $('.trait_checkbox:checked').length; - if (num_checked === 0) { - for (_i = 0, _len = buttons.length; _i < _len; _i++) { - button = buttons[_i]; - $(button).prop("disabled", true); - } - } else { - for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) { - button = buttons[_j]; - $(button).prop("disabled", false); - } - } - //}); - if ($(this).is(":checked")) { - if (!$(this).closest('tr').hasClass('selected')) { - $(this).closest('tr').addClass('selected') - } - } - else { - if ($(this).closest('tr').hasClass('selected')) { - $(this).closest('tr').removeClass('selected') - } - } - } - //ZS: Need to make sort by symbol, also need to make sure blank symbol fields at the bottom and symbols starting with numbers below letters trait_table = $('#trait_table').DataTable( { 'drawCallback': function( settings ) { - $('#trait_table tr').click(function(event) { - if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') { - $(':checkbox', this).trigger('click'); - } - }); - $('.trait_checkbox:checkbox').on("change", change_buttons); + $('#trait_table tr').off().on("click", function(event) { + if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') { + var obj =$(this).find('input'); + obj.prop('checked', !obj.is(':checked')); + } + if ($(this).hasClass("selected")){ + $(this).removeClass("selected") + } else { + $(this).addClass("selected") + } + change_buttons() + }); }, 'createdRow': function ( row, data, index ) { $('td', row).eq(0).attr("style", "text-align: center; padding: 0px 10px 2px 10px;"); |