aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2020-10-02 15:42:17 -0500
committerzsloan2020-10-02 15:42:17 -0500
commit23b6c0a2329c589db2b121584abaa06abe0d60da (patch)
treee6659856853da10def9afdd7413a30c9da69781d /wqflask
parenta1d6d81ceddd757370cd093aae6feeafa30d3858 (diff)
downloadgenenetwork2-23b6c0a2329c589db2b121584abaa06abe0d60da.tar.gz
Added function that pulls input data out of table and inserts it as hidden input elements in the form (so form submission can work with Scroller)
* wqflask/wqflask/static/new/javascript/show_trait.js - Added function "get_table_contents_for_form_submit" that is called with submit_special (that is called for correlations and mapping from the trait page)
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index a6f56d15..cde92160 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -499,6 +499,7 @@ edit_data_change = function() {
return update_prob_plot();
}
};
+
show_hide_outliers = function() {
var label;
label = $('#show_hide_outliers').val();
@@ -509,6 +510,7 @@ show_hide_outliers = function() {
return console.log("Should be now Hide Outliers");
}
};
+
on_corr_method_change = function() {
var corr_method;
corr_method = $('select[name=corr_type]').val();
@@ -523,10 +525,30 @@ 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");
$("#trait_data_form").attr("action", url);
$("#trait_data_form").submit();
};
+get_table_contents_for_form_submit = function(form_id) {
+ // Borrowed code from - https://stackoverflow.com/questions/31418047/how-to-post-data-for-the-whole-table-using-jquery-datatables
+ let this_form = $("#" + form_id);
+ var params = primary_table.$('input').serializeArray();
+
+ $.each(params, function(){
+ // If element doesn't exist in DOM
+ if(!$.contains(document, this_form[this.name])){
+ // Create a hidden element
+ this_form.append(
+ $('<input>')
+ .attr('type', 'hidden')
+ .attr('name', this.name)
+ .val(this.value)
+ );
+ }
+ });
+}
+
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',
'corr_return_results', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper']