4 <div id="brapi_home_study_table_div">
6 <h4>Study Observation Units Table</h4>
7 <input name="brapi_home_studytabledbid" id="brapi_home_studytabledbid" class="form-control" type="text" placeholder="StudyDbId e.g. 139" value="139"/>
8 <select name="brapi_home_studytable_datalevel" id="brapi_home_studytable_datalevel" class="form-control" />
9 <option value="plot">Plot</option>
10 <option value="plant">Plant</option>
11 <option value="all">All</option>
13 <select name="brapi_home_studytable_format" id="brapi_home_studytable_format" class="form-control" />
14 <option value="json">JSON (transformed to HTML table)</option>
15 <option value="csv">CSV</option>
16 <option value="xls">Excel (xls)</option>
18 <button class="btn btn-primary" name="brapi_home_studytabledbid_submit" id="brapi_home_studytabledbid_submit">Get Phenotypes</button>
20 <div id="brapi_studytable_detail_result_div">
22 <div id="brapi_studytable_data_result_div">
29 jQuery(document).ready(function() {
30 jQuery("#brapi_home_studytabledbid_submit").click(function() {
32 if (jQuery('#brapi_home_studytable_format').val() == 'json') {
34 'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/studies/'+jQuery('#brapi_home_studytabledbid').val()+'/table?format='+jQuery('#brapi_home_studytable_format').val()+'&observationLevel='+jQuery("#brapi_home_studytable_datalevel").val(),
36 'success': function(response) {
37 console.log(response);
38 var html = '<table class="table table-bordered"><thead><tr><th>StudyDbId</th><th>HeaderRow</th><th>ObservationVariableDbIds</th><th>ObservationVariableNames</th></tr></thead><tbody><tr><td>'+response.result.studyDbId+'</td><td>'+response.result.headerRow+'</td><td>'+response.result.observationVariableDbIds+'</td><td>'+response.result.observationVariableNames+'</td></tr></tbody></table>';
39 jQuery('#brapi_studytable_detail_result_div').empty().html(html);
40 brapi_create_paginated_table(response.result.data, response.metadata.pagination, 'brapi_studytable_data_result_div', jQuery('#brapi_home_url_select').val()+'/brapi/v1/studies/'+jQuery('#brapi_home_studytabledbid').val()+'/table?format='+jQuery('#brapi_home_studytable_format').val()+'&observationLevel='+jQuery("#brapi_home_studytable_datalevel").val(), undefined);
43 error: function(response) {
44 alert('An error occurred');
48 window.open(jQuery('#brapi_home_url_select').val()+'/brapi/v1/studies/'+jQuery('#brapi_home_studytabledbid').val()+'/table?format='+jQuery('#brapi_home_studytable_format').val());