From dfc271b685ec0bf34734890857269ccd07886688 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 24 Jun 2021 20:43:46 +0000 Subject: Made large variety of changes to how widths are set; for some reason autoWidth isn't working as expected, so I manually set widths, sometimes as a function of the maximum length for a column's contents --- wqflask/wqflask/templates/search_result_page.html | 77 +++++++---------------- 1 file changed, 22 insertions(+), 55 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index b8bedfb5..c4a596d5 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -8,7 +8,6 @@ - {% endblock %} {% block content %} @@ -126,7 +125,7 @@ {% endif %} {% endif %} -
+
@@ -180,9 +179,7 @@ columnDefs = [ { 'data': null, - {% if wide_columns_exist == true %} 'width': "25px", - {% endif %} 'orderDataType': "dom-checkbox", 'orderable': false, 'targets': 0, @@ -193,9 +190,7 @@ { 'title': "Index", 'type': "natural", - {% if wide_columns_exist == true %} 'width': "35px", - {% endif %} 'targets': 1, 'data': "index" } @@ -204,9 +199,7 @@ 'title': "Record", 'type': "natural-minus-na", 'data': null, - {% if wide_columns_exist == true %} - 'width': "{{ max_widths.display_name * 5 }}px", - {% endif %} + 'width': "{{ max_widths.display_name * 8 }}px", 'targets': 2, 'render': function(data, type, row, meta) { return '' + data.display_name + '' @@ -215,9 +208,7 @@ { 'title': "Symbol", 'type': "natural", - {% if wide_columns_exist == true %} - 'width': "200px", - {% endif %} + 'width': "{{ max_widths.symbol * 8 }}px", 'targets': 3, 'data': "symbol" }, @@ -237,18 +228,14 @@ { 'title': "
Location
", 'type': "natural-minus-na", - {% if wide_columns_exist == true %} 'width': "125px", - {% endif %} 'targets': 5, 'data': "location" }, { 'title': "
Mean
", 'type': "natural-minus-na", - {% if wide_columns_exist == true %} 'width': "40px", - {% endif %} 'data': "mean", 'targets': 6, 'orderSequence': [ "desc", "asc"] @@ -257,18 +244,14 @@ 'title': "
Peak  
LOD  
", 'type': "natural-minus-na", 'data': "lod_score", - {% if wide_columns_exist == true %} 'width': "60px", - {% endif %} 'targets': 7, 'orderSequence': [ "desc", "asc"] }, { 'title': "
Peak Location
", 'type': "natural-minus-na", - {% if wide_columns_exist == true %} 'width': "125px", - {% endif %} 'targets': 8, 'data': "lrs_location" }, @@ -276,19 +259,15 @@ 'title': "
Effect  
Size  
", 'type': "natural-minus-na", 'data': "additive", - {% if wide_columns_exist == true %} 'width': "60px", - {% endif %} 'targets': 9, 'orderSequence': [ "desc", "asc"] }{% elif dataset.type == 'Publish' %}, { 'title': "Record", 'type': "natural-minus-na", + 'width': "{{ max_widths.display_name * 9 }}px", 'data': null, - {% if wide_columns_exist == true %} - 'width': "100px", - {% endif %} 'targets': 2, 'render': function(data, type, row, meta) { return '' + data.display_name + '' @@ -297,6 +276,11 @@ { 'title': "Description", 'type': "natural", + {% if (max_widths.description * 7) < 500 %} + 'width': "{{ max_widths.description * 7 }}px", + {% else %} + 'width': "500px", + {% endif %} 'data': null, 'targets': 3, 'render': function(data, type, row, meta) { @@ -310,9 +294,7 @@ { 'title': "
Mean
", 'type': "natural-minus-na", - {% if wide_columns_exist == true %} 'width': "60px", - {% endif %} 'data': "mean", 'targets': 4, 'orderSequence': [ "desc", "asc"] @@ -320,8 +302,10 @@ { 'title': "Authors", 'type': "natural", - {% if wide_columns_exist == true %} - 'width': "400px", + {% if (max_widths.authors * 7) < 500 %} + 'width': "{{ max_widths.authors * 7 }}px", + {% else %} + 'width': "500px", {% endif %} 'data': null, 'targets': 5, @@ -339,9 +323,7 @@ 'title': "
Year
", 'type': "natural-minus-na", 'data': null, - {% if wide_columns_exist == true %} 'width': "50px", - {% endif %} 'targets': 6, 'render': function(data, type, row, meta) { if (data.pubmed_id != "N/A"){ @@ -357,26 +339,20 @@ 'type': "natural-minus-na", 'data': "lod_score", 'targets': 7, - {% if wide_columns_exist == true %} 'width': "60px", - {% endif %} 'orderSequence': [ "desc", "asc"] }, { 'title': "
Peak Location
", 'type': "natural-minus-na", - {% if wide_columns_exist == true %} 'width': "120px", - {% endif %} 'targets': 8, 'data': "lrs_location" }, { 'title': "
Effect  
Size  
", 'type': "natural-minus-na", - {% if wide_columns_exist == true %} 'width': "60px", - {% endif %} 'data': "additive", 'targets': 9, 'orderSequence': [ "desc", "asc"] @@ -384,9 +360,7 @@ { 'title': "
Location
", 'type': "natural-minus-na", - {% if wide_columns_exist == true %} 'width': "120px", - {% endif %} 'targets': 2, 'data': "location" }{% endif %} @@ -457,20 +431,13 @@ "order": [[1, "asc" ]], "sDom": "iti", "destroy": true, - {% if wide_columns_exist != true %} - "autoWidth": true, - {% else %} "autoWidth": false, - {% endif %} "deferRender": true, "bSortClasses": false, - {% if trait_list|length > 20 %} "scrollY": "500px", - "scroller": true, "scrollCollapse": true, - {% else %} + "scroller": true, "iDisplayLength": -1, - {% endif %} "initComplete": function (settings) { //Add JQueryUI resizable functionality to each th in the ScrollHead table $('#' + tableId + '_wrapper .dataTables_scrollHead thead th').resizable({ @@ -488,24 +455,24 @@ } if (!first_run){ - table_settings['autoWidth'] = false; $('#table_container').css("width", String($('#trait_table').width() + width_change {% if trait_list|length > 20 %}+ 17{% endif %}) + "px"); //ZS : Change the container width by the change in width of the adjusted column, so the overall table size adjusts properly - } - let checked_rows = get_checked_rows(tableId); - trait_table = $('#' + tableId).DataTable(table_settings); - if (checked_rows.length > 0){ - recheck_rows(trait_table, checked_rows); + let checked_rows = get_checked_rows(tableId); + trait_table = $('#' + tableId).DataTable(table_settings); + if (checked_rows.length > 0){ + recheck_rows(trait_table, checked_rows); + } + } else { + trait_table = $('#' + tableId).DataTable(table_settings); + trait_table.draw(); } if (first_run){ {% if trait_list|length > 20 %} $('#table_container').css("width", String($('#trait_table').width() + 17) + "px"); {% else %} - {% if wide_columns_exist != true %} $('#table_container').css("width", String($('#trait_table').width()) + "px"); {% endif %} - {% endif %} } } -- cgit v1.2.3

Loading...