From bd3b9516abcad0c368d8f9e1de161030e26c5f8a Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Mar 2016 15:53:23 +0000 Subject: Trait sample data table width now dynamically changes with number of attributes and standard error --- wqflask/wqflask/show_trait/show_trait.py | 13 +++++++++++++ wqflask/wqflask/templates/show_trait.html | 22 +++++++++++----------- .../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 @@ - +