diff options
author | Pjotr Prins | 2016-06-14 13:04:21 +0000 |
---|---|---|
committer | Pjotr Prins | 2016-06-14 13:04:21 +0000 |
commit | c1ff3255b45a7ae361679a97a9760a61d79b8daf (patch) | |
tree | c1deadb99390e97bae613d5552cdf4676f4b3c87 /wqflask | |
parent | 3ff17fe4789fe8d7d1b84c9db55b148fbd9a0418 (diff) | |
download | genenetwork2-c1ff3255b45a7ae361679a97a9760a61d79b8daf.tar.gz |
Menu: fetch group info from server
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/dataset_select_menu.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js index 9b6147c5..f62abbf3 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js +++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 1.8.0 $(function() { - var apply_default, check_search_term, dataset_info, group_info, make_default, open_window, populate_dataset, populate_group, populate_species, populate_type, process_json, redo_dropdown; + var apply_default, check_search_term, dataset_info, group_info, make_default, open_window, populate_dataset, populate_group, populate_species, populate_type, process_json, redo_dropdown, gndata; process_json = function(data) { window.jdata = data; populate_species(); @@ -11,17 +11,19 @@ $(function() { success: process_json }); $.getJSON("http://localhost:8880/int/menu/main", - function(data) { + function(data) { + gndata = data; console.log("***** GOT DATA from GN_SERVER ****"); - console.log(data); - var species = data["species"].map(function(item) { - console.log(item) + console.log(gndata); + var species = gndata.species.map(function(item) { + // console.log(item) menu = [item[1],item[2]] - console.log(menu) + // console.log(menu) return menu; }); - console.log(species); - redo_dropdown($('#species'), species); + console.log(species); + redo_dropdown($('#species'), species); + populate_group(); }); populate_species = function() { @@ -32,11 +34,13 @@ $(function() { }; window.populate_species = populate_species; populate_group = function() { - var group_list, species; console.log("in populate group"); - species = $('#species').val(); - group_list = this.jdata.groups[species]; - redo_dropdown($('#group'), group_list); + var species = $('#species').val(); + var groups = gndata.groups[species].map(function(item) { + console.log(item); + return [item[1],item[2]]; + }) + redo_dropdown($('#group'), groups); return populate_type(); }; window.populate_group = populate_group; |