aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2016-04-13 20:36:50 +0000
committerzsloan2016-04-13 20:36:50 +0000
commit5c47200dece98c44bac60bb8ceb86e787ef02a16 (patch)
treeb3eed2449dfc8f7f88ffd60be351a7631476a0d5 /wqflask
parent14dcf6db10a5e80d6d2cfa1c1102bef8c68887e6 (diff)
downloadgenenetwork2-5c47200dece98c44bac60bb8ceb86e787ef02a16.tar.gz
All the datatables stuff should be passable by AJAX now, just need to figure out how
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/templates/gsearch_gene.html21
-rw-r--r--wqflask/wqflask/update_search_results.py28
-rw-r--r--wqflask/wqflask/views.py3
3 files changed, 35 insertions, 17 deletions
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index 7898435c..92b0b411 100755
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -140,10 +140,11 @@
"paging": false,
"ajax": {
"url": "/gsearch_updating?terms={{ terms }}&type={{ type }}",
+ "type": "POST",
"dataType": "json",
"contentType": "application/json; charset=utf-8",
- "complete": function(response) {
- console.log("Response:" + JSON.stringify(response));
+ "data": function ( args ) {
+ return { "args": JSON.stringify( args ) };
}
},
"buttons": [
@@ -157,6 +158,22 @@
}
}
],
+ "columns": [
+ { "data": "checkbox", "orderable" : false },
+ { "data": "index", "orderable" : true },
+ { "data": "species", "orderable" : true },
+ { "data": "group", "orderable" : true },
+ { "data": "tissue", "orderable" : true },
+ { "data": "dataset", "orderable" : true },
+ { "data": "record", "orderable" : true },
+ { "data": "symbol", "orderable" : true },
+ { "data": "description", "orderable" : true },
+ { "data": "location", "orderable" : true },
+ { "data": "mean", "orderable" : true },
+ { "data": "max_lrs", "orderable" : true },
+ { "data": "max_lrs_location", "orderable" : true },
+ { "data": "additive_effect", "orderable" : true }
+ ],
"sDom": "Bfrti",
"autoWidth": false,
"scrollY": "800px",
diff --git a/wqflask/wqflask/update_search_results.py b/wqflask/wqflask/update_search_results.py
index 7de2d8c0..ffd7fd51 100644
--- a/wqflask/wqflask/update_search_results.py
+++ b/wqflask/wqflask/update_search_results.py
@@ -105,20 +105,20 @@ class GSearch(object):
json_dict['data'] = []
for i, trait in enumerate(self.trait_list):
- trait_row = ["<INPUT TYPE=\"checkbox\" NAME=\"searchResult\" class=\"checkbox trait_checkbox\" style=\"transform: scale(1.5);\" VALUE=\"{}:{}\">".format(trait.name, trait.dataset.name),
- i+1,
- trait.dataset.group.species,
- trait.dataset.group.name,
- trait.dataset.tissue,
- trait.dataset.fullname,
- "<a href=\"/show_trait?trait_id=" + trait.name + "&dataset=" + trait.dataset.name + "\">" + trait.name + "</a>",
- trait.symbol,
- trait.description_display,
- trait.location_repr,
- trait.mean,
- trait.LRS_score_repr,
- trait.LRS_location_repr,
- trait.additive]
+ trait_row = { "checkbox": "<INPUT TYPE=\"checkbox\" NAME=\"searchResult\" class=\"checkbox trait_checkbox\" style=\"transform: scale(1.5);\" VALUE=\"{}:{}\">".format(trait.name, trait.dataset.name),
+ "index": i+1,
+ "species": trait.dataset.group.species,
+ "group": trait.dataset.group.name,
+ "tissue": trait.dataset.tissue,
+ "dataset": trait.dataset.fullname,
+ "record": "<a href=\"/show_trait?trait_id=" + trait.name + "&dataset=" + trait.dataset.name + "\" target=\"_blank\">" + trait.name + "</a>",
+ "symbol": trait.symbol,
+ "description": trait.description_display,
+ "location": trait.location_repr,
+ "mean": trait.mean,
+ "max_lrs": trait.LRS_score_repr,
+ "max_lrs_location": trait.LRS_location_repr,
+ "additive_effect": trait.additive}
json_dict['data'].append(trait_row)
json_results = json.dumps(json_dict)
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 6184edc7..412491a1 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -168,8 +168,9 @@ def gsearchact():
elif type == "phenotype":
return render_template("gsearch_pheno.html", **result)
-@app.route("/gsearch_updating", methods=('GET',))
+@app.route("/gsearch_updating", methods=('POST',))
def gsearch_updating():
+ print("REQUEST ARGS:", request.values)
result = update_search_results.GSearch(request.args).__dict__
return result['results']
# type = request.args['type']