aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/gsearch.py54
-rw-r--r--wqflask/wqflask/templates/gsearch_gene.html15
-rw-r--r--wqflask/wqflask/templates/gsearch_pheno.html15
-rw-r--r--wqflask/wqflask/views.py13
4 files changed, 80 insertions, 17 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 44a8f7f7..4024fa7a 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -130,7 +130,7 @@ class GSearch:
trait_list.append(this_trait)
self.trait_count = len(trait_list)
- self.trait_list = json.dumps(trait_list)
+ self.trait_list = trait_list
self.header_fields = ['Index',
'Record',
@@ -146,6 +146,22 @@ class GSearch:
'Max LRS Location',
'Additive Effect']
+ self.header_data_names = [
+ 'index',
+ 'name',
+ 'species',
+ 'group',
+ 'tissue',
+ 'dataset_fullname',
+ 'symbol',
+ 'description',
+ 'location_repr',
+ 'mean',
+ 'LRS_score_repr',
+ 'max_lrs_text',
+ 'additive',
+ ]
+
elif self.type == "phenotype":
search_term = self.terms
group_clause = ""
@@ -263,15 +279,31 @@ class GSearch:
trait_list.append(this_trait)
self.trait_count = len(trait_list)
- self.trait_list = json.dumps(trait_list)
+ self.trait_list = trait_list
self.header_fields = ['Index',
- 'Species',
- 'Group',
- 'Record',
- 'Description',
- 'Authors',
- 'Year',
- 'Max LRS',
- 'Max LRS Location',
- 'Additive Effect']
+ 'Species',
+ 'Group',
+ 'Record',
+ 'Description',
+ 'Authors',
+ 'Year',
+ 'Max LRS',
+ 'Max LRS Location',
+ 'Additive Effect']
+
+ self.header_data_names = [
+ 'index',
+ 'name',
+ 'species',
+ 'group',
+ 'tissue',
+ 'dataset_fullname',
+ 'symbol',
+ 'description',
+ 'location_repr',
+ 'mean',
+ 'LRS_score_repr',
+ 'max_lrs_text',
+ 'additive',
+ ]
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index 6fd0abe8..48953d98 100644
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -55,7 +55,15 @@
<script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script>
<script type='text/javascript'>
- var the_rows = {{ trait_list|safe }};
+ var getParams = function(url) {
+ let parser = document.createElement('a');
+ parser.href = url;
+ let params = parser.search.substring(1);
+ if(params.length > 0) {
+ return ('?'+params);
+ }
+ return params;
+ };
</script>
<script type="text/javascript" charset="utf-8">
@@ -142,7 +150,6 @@
$('td', row).eq(12).attr('data-export', $('td', row).eq(12).text());
$('td', row).eq(13).attr('data-export', $('td', row).eq(13).text());
},
- 'data': the_rows,
'columns': [
{
'data': null,
@@ -237,11 +244,13 @@
'order': [[1, "asc" ]],
'sDom': "pitirp",
'autoWidth': true,
- 'iDisplayLength': 500,
'deferRender': false,
'paging': true,
'orderClasses': true,
'processing': true,
+ 'iDisplayLength': 100,
+ 'bServerSide': true,
+ 'sAjaxSource': '/gsearch_table'+getParams(window.location.href),
'language': {
'loadingRecords': '&nbsp;',
'processing': 'Loading...'
diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html
index 987b51a7..af9740ae 100644
--- a/wqflask/wqflask/templates/gsearch_pheno.html
+++ b/wqflask/wqflask/templates/gsearch_pheno.html
@@ -55,7 +55,15 @@
<script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script>
<script type='text/javascript'>
- var the_rows = {{ trait_list|safe }};
+ var getParams = function(url) {
+ let parser = document.createElement('a');
+ parser.href = url;
+ let params = parser.search.substring(1);
+ if(params.length > 0) {
+ return ('?'+params);
+ }
+ return params;
+ };
</script>
<script type="text/javascript" charset="utf-8">
@@ -130,7 +138,6 @@
$('td', row).eq(9).attr('data-export', $('td', row).eq(9).text());
$('td', row).eq(10).attr('data-export', $('td', row).eq(10).text());
},
- 'data': the_rows,
'columns': [
{
'data': null,
@@ -241,10 +248,12 @@
'sDom': "pitirp",
'autoWidth': false,
'deferRender': false,
- 'iDisplayLength': 500,
'paging': true,
'orderClasses': true,
'processing': true,
+ 'iDisplayLength': 100,
+ 'bServerSide': true,
+ 'sAjaxSource': '/gsearch_table'+getParams(window.location.href),
'language': {
'loadingRecords': '&nbsp;',
'processing': 'Loading...'
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 276d3019..d2ede70f 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -279,6 +279,19 @@ def gsearchact():
elif type == "phenotype":
return render_template("gsearch_pheno.html", **result)
+@app.route("/gsearch_table", methods=('GET',))
+def gsearchtable():
+ logger.info(request.url)
+
+ gsearch_table_data = GSearch(request.args)
+ current_page = server_side.ServerSideTable(
+ gsearch_table_data.trait_count,
+ gsearch_table_data.trait_list,
+ gsearch_table_data.header_data_names,
+ request.args,
+ ).get_page()
+
+ return flask.jsonify(current_page)
@app.route("/gsearch_updating", methods=('POST',))
def gsearch_updating():