From 0ba1ec77fd734658d4409e4cd6148523a6bca568 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 11 Nov 2019 11:47:33 -0600 Subject: Added option to search through sample table on trait page --- wqflask/wqflask/templates/show_trait.html | 22 ++++++++++++++++++---- .../wqflask/templates/show_trait_edit_data.html | 19 ++++++++++--------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 3e4a6d7c..f6121d7b 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -225,7 +225,7 @@ {% endif %} {% endif %} - $('#samples_primary').DataTable( { + var primary_table = $('#samples_primary').DataTable( { 'initComplete': function(settings, json) { $('.edit_sample_value').change(function() { edit_data_change(); @@ -268,6 +268,7 @@ { 'data': null, 'orderDataType': "dom-checkbox", + 'searchable' : false, 'render': function(data, type, row, meta) { return '' } @@ -275,7 +276,8 @@ { 'title': "ID", 'type': "natural", - 'data': "this_id" + 'data': "this_id", + 'searchable' : false }, { 'title': "Sample", @@ -302,6 +304,7 @@ 'bSortable': false, 'type': "natural", 'data': null, + 'searchable' : false, 'render': function(data, type, row, meta) { return '±' } @@ -356,8 +359,12 @@ } } ); + $('#primary_searchbox').on( 'keyup', function () { + primary_table.search($(this).val()).draw(); + } ); + {% if sample_groups|length != 1 %} - $('#samples_other').DataTable( { + var other_table = $('#samples_other').DataTable( { 'initComplete': function(settings, json) { $('.edit_sample_value').change(function() { edit_data_change(); @@ -400,6 +407,7 @@ { 'data': null, 'orderDataType': "dom-checkbox", + 'searchable' : false, 'render': function(data, type, row, meta) { return '' } @@ -407,7 +415,8 @@ { 'title': "ID", 'type': "natural", - 'data': "this_id" + 'data': "this_id", + 'searchable' : false }, { 'title': "Sample", @@ -434,6 +443,7 @@ 'bSortable': false, 'type': "natural", 'data': null, + 'searchable' : false, 'render': function(data, type, row, meta) { return '±' } @@ -487,6 +497,10 @@ 'processing': 'Loading...' } } ); + + $('#other_searchbox').on( 'keyup', function () { + other_table.search($(this).val()).draw(); + } ); {% endif %} $('#samples_primary, #samples_other').find("tr.outlier").css('background-color', 'orange') diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html index fec141dc..e342a3f8 100644 --- a/wqflask/wqflask/templates/show_trait_edit_data.html +++ b/wqflask/wqflask/templates/show_trait_edit_data.html @@ -13,15 +13,16 @@ {% for sample_type in sample_groups %} {% set outer_loop = loop %}
-

{{ sample_type.header }}

-
-
- - - - -

Loading...
-
+
+

{{ sample_type.header }}

+
+
+ + + + +

Loading...
+

{% endfor %} -- cgit 1.4.1