aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 77ef1720..3957175b 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -713,10 +713,24 @@ block_by_index = function() {
for (_k = 0, _len1 = index_list.length; _k < _len1; _k++) {
index = index_list[_k];
val_nodes[index - 1].childNodes[0].value = "x";
-
}
};
+filter_by_study = function() {
+ let this_study = $('#filter_study').val();
+ let block_group = $('#filter_study_group').val();
+ let study_sample_data = JSON.parse($('input[name=study_samplelists]').val())
+ let filter_samples = study_sample_data[parseInt(this_study)]['samples']
+ let sample_nodes = table_api.column(2).nodes().to$();
+ let val_nodes = table_api.column(3).nodes().to$();
+ for (i = 0; i < sample_nodes.length; i++) {
+ this_sample = sample_nodes[i].childNodes[0].innerText;
+ if (!filter_samples.includes(this_sample)){
+ val_nodes[i].childNodes[0].value = "x";
+ }
+ }
+}
+
filter_by_value = function() {
let filter_logic = $('#filter_logic').val();
let filter_column = $('#filter_column').val();
@@ -1690,6 +1704,11 @@ $('#block_by_index').click(function(){
edit_data_change();
});
+$('#filter_by_study').click(function(){
+ filter_by_study();
+ edit_data_change();
+})
+
$('#filter_by_value').click(function(){
filter_by_value();
edit_data_change();