From d5c6bb7abfb3535c1fa5d0d8df95645a213ab030 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 23 Jun 2022 20:11:28 +0000 Subject: Remove HTML table from collections/view.html and replace with list of column definitions passed to create_datatable.js --- wqflask/wqflask/templates/collections/view.html | 215 +++++++++++++++--------- 1 file changed, 138 insertions(+), 77 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 6d0e3edd..6ea129f9 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -95,72 +95,9 @@
- - - - - - - - - - - - - - - - - {% for this_trait in trait_obs %} - - - - - - {% if this_trait.symbol %} - - {% elif this_trait.abbreviation %} - - {% else %} - - {% endif %} - {% if this_trait.dataset.type == "Geno" %} - - {% elif this_trait.description_display != "" %} - - {% else %} - - {% endif %} - - - {% if this_trait.LRS_score_repr|float > 0 %} - - {% else %} - - {% endif %} - - {% if this_trait.additive|float != 0 %} - - {% else %} - - {% endif %} - - {% endfor %} + -
IndexDatasetRecordSymbolDescriptionLocationMeanHigh P ?Peak LocationEffect Size ?
- {{ loop.index }}{{ this_trait.dataset.fullname }} - - {{ this_trait.display_name }} - - {% if this_trait.symbol|length > 20 %}{{ this_trait.symbol[:20] }}...{% else %}{{ this_trait.symbol }}{% endif %}{% if this_trait.abbreviation|length > 20 %}{{ this_trait.abbreviation[:20] }}...{% else %}{{ this_trait.abbreviation }}{% endif %}N/AMarker: {{ this_trait.name }}{{ this_trait.description_display }}N/A{{ this_trait.location_repr }}{{ '%0.3f' % this_trait.mean|float }}{{ '%0.3f' % this_trait.LRS_score_repr|float }}N/A{{ this_trait.LRS_location_repr }}{{ '%0.3f' % this_trait.additive|float }}N/A

Loading...

@@ -198,20 +135,144 @@ column_defs = [ { - "orderDataType": "dom-checkbox", - "orderSequence": [ "desc", "asc"], - "width": 10 + 'data': null, + 'width': "5px", + 'orderDataType': "dom-checkbox", + 'targets': 0, + 'render': function(data, type, row, meta) { + return '' + } + }, + { + 'title': "Index", + 'type': "natural", + 'width': "35px", + 'searchable': false, + 'orderable': false, + 'targets': 1, + 'render': function(data, type, row, meta) { + return meta.row + } + }, + { + 'title': "Dataset", + 'type': "natural", + 'targets': 2, + 'data': "dataset" + }, + { + 'title': "Record", + 'type': "natural-minus-na", + 'width': "120px", + 'targets': 3, + 'data': null, + 'render': function(data, type, row, meta) { + return '' + data.display_name + '' + } }, - { "type": "natural", "width": 50 }, - { "type": "natural" }, - { 'type': "natural-minus-na", "width": 120 }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural", "width": 125 }, - { "type": "natural", "width": 60 }, - { "type": "natural", "width": 60 }, - { "type": "natural", "width": 125 }, - { "type": "natural", "width": 85 } + { + 'title': "Symbol", + 'type': "natural", + 'targets': 4, + 'data': null, + 'render': function(data, type, row, meta) { + if (Object.hasOwn(data, 'symbol')){ + return data.symbol + } else { + return "N/A" + } + } + }, + { + 'title': "Description", + 'type': "natural", + 'targets': 5, + 'data': null, + 'render': function(data, type, row, meta) { + if (Object.hasOwn(data, 'description')){ + try { + return decodeURIComponent(escape(data.description)) + } catch(err){ + return escape(data.description) + } + } else { + return "N/A" + } + } + }, + { + 'title': "
Location
", + 'type': "natural-minus-na", + 'width': "125px", + 'targets': 6, + 'data': null, + 'render': function(data, type, row, meta) { + if (Object.hasOwn(data, 'location')){ + return data.location + } else { + return "N/A" + } + } + }, + { + 'title': "
Mean
", + 'type': "natural-minus-na", + 'width': "60px", + 'data': null, + 'targets': 7, + 'orderSequence': [ "desc", "asc"], + 'render': function(data, type, row, meta) { + if (Object.hasOwn(data, 'mean')){ + return data.mean.toFixed(3) + } else { + return "N/A" + } + } + }, + { + 'title': "
Peak
LOD ?
", + 'type': "natural-minus-na", + 'data': null, + 'width': "60px", + 'targets': 8, + 'orderSequence': [ "desc", "asc"], + 'render': function(data, type, row, meta) { + if (Object.hasOwn(data, 'lrs_score')){ + return (data.lrs_score / 4.61).toFixed(3) + } else { + return "N/A" + } + } + }, + { + 'title': "
Peak Location
", + 'type': "natural-minus-na", + 'data': null, + 'width': "125px", + 'targets': 9, + 'render': function(data, type, row, meta) { + if (Object.hasOwn(data, 'lrs_location')){ + return data.lrs_location + } else { + return "N/A" + } + } + }, + { + 'title': "
Effect
Size ?
", + 'type': "natural-minus-na", + 'data': null, + 'width': "85px", + 'targets': 10, + 'orderSequence': [ "desc", "asc"], + 'render': function(data, type, row, meta) { + if (Object.hasOwn(data, 'additive')){ + return data.additive.toFixed(3) + } else { + return "N/A" + } + } + } ] table_settings = { -- cgit v1.2.3