From 62424a50ab0887e295542b8b4982faf1d445198a Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 11 Nov 2019 14:22:28 -0600 Subject: Fixed issue that caused datatables error when case attributes missing --- wqflask/wqflask/templates/show_trait.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index f6121d7b..0f49b092 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -328,7 +328,7 @@ 'type': "cust-txt", 'data': null, 'render': function(data, type, row, meta) { - if (data.num_cases == null) { + if (data.num_cases == null || data.num_cases == undefined) { return '' } else { return '' @@ -340,7 +340,11 @@ 'type': "natural", 'data': null, 'render': function(data, type, row, meta) { - return data.extra_attributes['{{ sample_groups[0].attributes[attribute].name }}'] + if (data.extra_attributes['{{ sample_groups[0].attributes[attribute].name }}'] != null && data.extra_attributes['{{ sample_groups[0].attributes[attribute].name }}'] != undefined){ + return data.extra_attributes['{{ sample_groups[0].attributes[attribute].name }}'] + } else { + return "" + } } }{% endfor %}{% endif %} ], @@ -479,7 +483,11 @@ 'type': "natural", 'data': null, 'render': function(data, type, row, meta) { - return data.extra_attributes['{{ sample_groups[1].attributes[attribute].name }}'] + if (data.extra_attributes['{{ sample_groups[1].attributes[attribute].name }}'] != null && data.extra_attributes['{{ sample_groups[1].attributes[attribute].name }}'] != undefined){ + return data.extra_attributes['{{ sample_groups[1].attributes[attribute].name }}'] + } else { + return "" + } } }{% endfor %}{% endif %} ], -- cgit v1.2.3