aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/search_results.py16
-rw-r--r--wqflask/wqflask/templates/search_result_page.html21
-rw-r--r--wqflask/wqflask/views.py20
3 files changed, 47 insertions, 10 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index ce836ce2..8a5a7a80 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -28,9 +28,9 @@ class SearchResultPage(object):
#maxReturn = 3000
def __init__(self, kw):
- """This class gets invoked after hitting submit on the main menu (in
-views.py).
-
+ """
+ This class gets invoked after hitting submit on the main menu (in
+ views.py).
"""
###########################################
@@ -86,7 +86,6 @@ views.py).
else:
self.gen_search_result()
-
def gen_search_result(self):
"""
Get the info displayed in the search result table from the set of results computed in
@@ -155,7 +154,14 @@ views.py).
trait_dict[key] = trait_dict[key].decode('utf-8')
trait_list.append(trait_dict)
- self.trait_list = json.dumps(trait_list)
+ self.trait_list = trait_list
+
+ if this_trait.dataset.type == "ProbeSet":
+ self.header_data_names = ['index', 'display_name', 'symbol', 'description', 'location', 'mean', 'lrs_score', 'lrs_location', 'additive']
+ elif this_trait.dataset.type == "Publish":
+ self.header_data_names = ['index', 'display_name', 'description', 'mean', 'authors', 'pubmed_text', 'lrs_score', 'lrs_location', 'additive']
+ elif this_trait.dataset.type == "Geno":
+ self.header_data_names = ['index', 'display_name', 'location']
def search(self):
"""
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 2318bfb8..7d36d32e 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -174,6 +174,16 @@
<script type="text/javascript" charset="utf-8">
$(document).ready( function () {
+
+ var getParams = function(url) {
+ var parser = document.createElement('a');
+ parser.href = url;
+ var params = parser.search.substring(1);
+ if(params.length > 0) {
+ return ('?'+params);
+ }
+ return params;
+ };
$('#trait_table tr').click(function(event) {
if (event.target.type !== 'checkbox') {
@@ -260,7 +270,7 @@
'data': null,
'width': "25px",
'orderDataType': "dom-checkbox",
- 'orderSequence': [ "desc", "asc"],
+ 'orderable': false,
'render': function(data, type, row, meta) {
return '<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="' + data.hmac + '">'
}
@@ -426,14 +436,15 @@
{% else %}
'sDom': "pitirp",
{% endif %}
- 'iDisplayLength': 500,
+ 'iDisplayLength': 10,
'deferRender': true,
'paging': true,
'orderClasses': true,
'processing': true,
- 'language': {
- 'loadingRecords': '&nbsp;',
- 'processing': 'Loading...'
+ 'bServerSide': true,
+ 'sAjaxSource': '/search_table'+getParams(window.location.href),
+ 'infoCallback': function(settings, start, end, max, total, pre) {
+ return "Showing " + start + " to " + (start + this.api().data().length - 1) + " of " + total + " entries";
}
} );
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 63570815..2c1fa94b 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -234,6 +234,26 @@ def search_page():
else:
return render_template("search_error.html")
+@app.route("/search_table", methods=('GET',))
+def search_page_table():
+ logger.info("in search_page table")
+ logger.info(request.url)
+
+ logger.info("request.args is", request.args)
+ the_search = search_results.SearchResultPage(request.args)
+
+ logger.info(type(the_search.trait_list))
+ logger.info(the_search.trait_list)
+
+ current_page = server_side.ServerSideTable(
+ len(the_search.trait_list),
+ the_search.trait_list,
+ the_search.header_data_names,
+ request.args,
+ ).get_page()
+
+ return flask.jsonify(current_page)
+
@app.route("/gsearch", methods=('GET',))
def gsearchact():
logger.info(request.url)