From 657ab53bef4fc767fdc549f004153a7910b45bd0 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 10 Sep 2020 14:33:52 -0500 Subject: Fixed several sorting issues and moved orderDataType definitions into search_results.js since all the tables that use them import that file (that file's name needs to be changed, though) * wqflask/wqflask/static/new/javascript/search_results.js - Added the dom-checkbox and dom-inner-text order types into this file; they were previously duplicated across several template files * wqflask/wqflask/templates/gsearch_gene.html - Added dom-inner-text order type to relevant columns with hyperlink contents and disabled deferRender since it conflicted with use of both pagination and orderDataType for sorting * wqflask/wqflask/templates/gsearch_pheno.html - Same as above * wqflask/wqflask/templates/mapping_results.html - Added dom-inner-text for a few columns that have hyperlink values - still need to modify natural-minus-na to also include other "N/A"-equivalent values like "--" * wqflask/wqflask/templates/search_result_page.html Removed the dom-checkbox and dom-inner-text order types from this file since they were moved to search_results.js --- wqflask/wqflask/static/new/javascript/search_results.js | 14 ++++++++++++++ wqflask/wqflask/templates/gsearch_gene.html | 16 +--------------- wqflask/wqflask/templates/gsearch_pheno.html | 17 ++--------------- wqflask/wqflask/templates/mapping_results.html | 12 ++++++------ wqflask/wqflask/templates/search_result_page.html | 15 --------------- 5 files changed, 23 insertions(+), 51 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 4e87d67a..b696dc4d 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -281,4 +281,18 @@ $(function() { } }); + $.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col ) + { + return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) { + return $('input', td).prop('checked') ? '1' : '0'; + } ); + }; + + $.fn.dataTable.ext.order['dom-inner-text'] = function ( settings, col ) + { + return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) { + return $(td).text(); + } ); + } + }); \ No newline at end of file diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 478d6f5f..d2c78d65 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -59,20 +59,6 @@