6 <& /util/import_javascript.mas, classes => ['jquery.dataTables-buttons-min', 'jquery.iframe-post-form', 'jszip-min', 'pdfmake.pdfmake-min', 'pdfmake.vfs_fonts', 'buttons.bootstrap-min', 'buttons.html5-min', 'buttons.print-min', 'buttons.colvis-min'] &>
8 <div class="table-responsive" style="margin-top: 10px;">
9 <table id="location_table" class="table table-hover table-striped table-bordered" width="100%">
22 <th>Nearest NOAA Station ID</th>
25 <!-- <caption class="well well-sm" style="caption-side: bottom;margin-top: 10px;"><center> Locations </center></caption> -->
30 <& /breeders_toolbox/upload_locations_dialogs.mas &>
32 <script defer="defer">
34 jQuery(document).ready(function() {
37 url: '/ajax/location/all',
38 beforeSend: function() {
39 // put working animation handling here
41 success: function(response) {
42 var export_message = 'Location data from ' + window.location.href;
43 locationJSON = response.data;
44 // console.log("Data is "+JSON.stringify(locationJSON, null, 2));
46 // Remove [Computataion] location from response
47 locationJSON = locationJSON.filter(function(loc) {
48 return loc.properties.Name !== '[Computation]';
51 var table = jQuery('#location_table').DataTable( {
54 rowId: 'properties.Id',
56 { "data": "properties.Id" },
57 { "data": "properties.Name" },
58 { "data": "properties.Abbreviation" },
59 { "data": "properties.Code",
60 "render":function(data, type, full, meta){
61 return full.properties.Code + ' ' + full.properties.Country;
64 { "data": "properties.Program" },
65 { "data": "properties.Type" },
66 { "data": "properties.Latitude" },
67 { "data": "properties.Longitude" },
68 { "data": "properties.Altitude" },
69 { "data": "properties.Trials" },
70 { "data": "properties.NOAAStationID",
71 "render":function(data, type, full, meta) {
72 return full.properties.NOAAStationID ? "<a href='https://www.ncdc.noaa.gov/cdo-web/datasets/GHCND/stations/" + full.properties.NOAAStationID + "/detail' target=_blank>"+ full.properties.NOAAStationID + "</a>" : "";
85 title: document.title +'_locations',
92 title: document.title +'_locations',
99 title: document.title +'_locations',
103 message: export_message
110 message: export_message
113 drawCallback: function( settings ) {
114 var api = this.api();
115 var name_data = api.column(1, { search:'applied' } ).data();
117 for (var i = 0; i < name_data.length; i++) { //extract names from data object
118 names.push(name_data[i]+'\n');
120 //console.log("Names are: "+JSON.stringify(names));
121 $('#location_names').html(names);
122 addToListMenu('locations_to_list_menu', 'location_names', {
123 listType: 'locations'
128 var map = initialize_map('location_map', locationJSON, table);
131 error: function(response) {
132 alert("An error occurred");