diff options
-rwxr-xr-x | wqflask/wqflask/show_trait/show_trait.py | 13 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait.html | 22 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait_edit_data.html | 2 |
3 files changed, 25 insertions, 12 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index d6c48a12..3cc6121f 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -150,6 +150,8 @@ class ShowTrait(object): self.get_mapping_methods() + self.trait_table_width = get_trait_table_width(self.sample_groups) + js_data = dict(sample_group_types = self.sample_group_types, sample_lists = sample_lists, attribute_names = self.sample_groups[0].attributes, @@ -1256,5 +1258,16 @@ def get_nearest_marker(this_trait, this_db): else: return result[0][0] #return result[0][0], result[1][0] + +def get_trait_table_width(sample_groups): + table_width = 35 + if sample_groups[0].se_exists(): + table_width += 10 + if (table_width + len(sample_groups[0].attributes)*10) > 100: + table_width = 100 + else: + table_width += len(sample_groups[0].attributes)*10 + + return table_width diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 4720f8ec..73bd8e4b 100755 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -151,7 +151,7 @@ <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.scientific.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script <script language="javascript" type="text/javascript" src="/static/new/packages/noUiSlider/nouislider.js"></script> <script type="text/javascript" charset="utf-8"> @@ -208,7 +208,10 @@ { "type": "natural" }, { "type": "cust-txt" }, { "bSortable": false }, - { "type": "cust-txt" } + { "type": "cust-txt" }{% if sample_groups[0].attributes|length > 0 %},{% endif %} + {% for attribute in sample_groups[0].attributes %} + { "type": "natural" }{% if loop.index < sample_groups[0].attributes|length %},{% endif %} + {% endfor %} ], "sDom": "RZtr", "iDisplayLength": -1, @@ -231,7 +234,10 @@ { "bSortable": false }, { "type": "natural" }, null, - { "type": "cust-txt" } + { "type": "cust-txt" }{% if sample_groups[0].attributes|length > 0 %},{% endif %} + {% for attribute in sample_groups[0].attributes %} + { "type": "natural" }{% if loop.index < sample_groups[0].attributes|length %},{% endif %} + {% endfor %} ], "sDom": "RZtr", "iDisplayLength": -1, @@ -257,15 +263,12 @@ { "bSortable": false }, { "bSortable": false } ], - "sDom": "RZtr", + "sDom": "tr", "iDisplayLength": -1, "autoWidth": false, "bLengthChange": true, "bDeferRender": true, "bSortClasses": false, - "colResize": { - "tableWidthFixed": false - }, "paging": false } ); } @@ -275,15 +278,12 @@ { "bSortable": false }, { "bSortable": false } ], - "sDom": "RZtr", + "sDom": "tr", "iDisplayLength": -1, "autoWidth": false, "bLengthChange": true, "bDeferRender": true, "bSortClasses": false, - "colResize": { - "tableWidthFixed": false - }, "paging": false } ); diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html index d39df976..228ef362 100755 --- a/wqflask/wqflask/templates/show_trait_edit_data.html +++ b/wqflask/wqflask/templates/show_trait_edit_data.html @@ -75,7 +75,7 @@ <!--<div id="edit_sample_lists">--> {% for sample_type in sample_groups %} - <div class="sample_group" style="width:50%;"> + <div class="sample_group" style="width:{{ trait_table_width }}%;"> <h3>{{ sample_type.header }}</h3> <table class="table-hover table-striped" id="samples_{{ sample_type.sample_group_type }}" style="float: left;"> |