aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2020-12-18 14:30:13 -0600
committerzsloan2020-12-18 14:30:13 -0600
commit47c15cdbd8d54afca05bf939dec8d7d461cff5a5 (patch)
treed698e6cd18a8a976c9a2b21ace1618671f95ef1e /wqflask
parentec1e37331e320ed674f184b738b9917753b6071f (diff)
downloadgenenetwork2-47c15cdbd8d54afca05bf939dec8d7d461cff5a5.tar.gz
Added function that fetches sample data and converts it to JSON to show_trait.js
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 98f90f7d..b71a9dd8 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -427,6 +427,25 @@ process_id = function() {
}
return processed;
};
+
+fetch_sample_values = function() {
+ // This is meant to fetch all sample values using DataTables API, since they can't all be submitted with the form when using Scroller (and this should also be faster)
+ sample_val_dict = {};
+
+ table = 'samples_primary';
+ if ($('#' + table).length){
+ table_api = $('#' + table).DataTable();
+ val_nodes = table_api.column(3).nodes().to$();
+ for (_j = 0; _j < val_nodes.length; _j++){
+ sample_name = val_nodes[_j].childNodes[0].name.split(":")[1]
+ sample_val = val_nodes[_j].childNodes[0].value
+ sample_val_dict[sample_name] = sample_val
+ }
+ }
+
+ return sample_val_dict;
+}
+
edit_data_change = function() {
var already_seen, checkbox, name, real_dict, real_value, real_variance, row, rows, sample_sets, table, tables, _i, _j, _len, _len1;
already_seen = {};
@@ -525,7 +544,7 @@ on_corr_method_change = function() {
$('select[name=corr_type]').change(on_corr_method_change);
submit_special = function(url) {
- get_table_contents_for_form_submit("trait_data_form");
+ $("input[name=sample_vals]").val(JSON.stringify(fetch_sample_values()))
$("#trait_data_form").attr("action", url);
$("#trait_data_form").submit();
};
@@ -549,7 +568,7 @@ get_table_contents_for_form_submit = function(form_id) {
});
}
-var corr_input_list = ['corr_type', 'primary_samples', 'trait_id', 'dataset', 'group', 'tool_used', 'form_url', 'corr_sample_method', 'corr_samples_group', 'corr_dataset', 'min_expr',
+var corr_input_list = ['sample_vals', 'corr_type', 'primary_samples', 'trait_id', 'dataset', 'group', 'tool_used', 'form_url', 'corr_sample_method', 'corr_samples_group', 'corr_dataset', 'min_expr',
'corr_return_results', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper']
$(".corr_compute").on("click", (function(_this) {