message dialog and js
[sgn.git] / mason / search / genotyping_data_projects.mas
blob4764f99210baf0cab88d549ff9ee8b7715e489f5
2 <%args>
3 </%args>
5 <& /util/import_javascript.mas, classes => [ 'jquery', 'jquery.dataTables' ] &>
7 <& /page/page_title.mas, title => "Genotyping Data Project Search" &>
9 <div class="well well-sm">
10     <div class="panel panel-default">
11         <div class="panel-body">
12             <table id="genotyping_data_project_search_results" width="100%" class="table table-hover table-striped">
13             <thead>
14               <tr>
15                   <th>Genotyping Data Project Name</th>
16                   <th>Description</th>
17                   <th>Breeding program</th>
18                   <th>Folder</th>
19                   <th>Year</th>
20                   <th>Location</th>
21                   <th>Genotyping Facility</th>
22             </tr>
23             </thead>
24             </table>
25         </div>
26     </div>
28     <div class="panel panel-default">
29         <div class="panel-body">
30             <br><br>
31             <&| /page/info_section.mas, title => 'Copy Results to a List', collapsible=>1, collapsed=>0, subtitle=>'<i>Copy the trial names currently showing in the search results table to a new or exisiting list</i>'&>
32                 <br>
33                 <div style="text-align:right" id="genotyping_data_project_to_list_menu"></div>
34                 <div id="genotyping_data_project_result_names" style="display: none;"></div>
35             </&>
36         </div>
37     </div>
38 </div>
41 <script>
43 jQuery(document).ready(function () {
45    var trial_table = jQuery('#genotyping_data_project_search_results').DataTable( {
46        'ajax': '/ajax/genotyping_data_project/search',
47        "scrollX": true
48    });
50    jQuery('#genotyping_data_project_search_results').on( 'draw.dt', function () {
51      var name_links = trial_table.column( 0, {page:'current'} ).data();
52      var names = [];
54      for (var i = 0; i < name_links.length; i++) { //extract text from anchor tags
55        names.push(name_links[i].match(/<a [^>]+>([^<]+)<\/a>/)[1]+'\n');
56      }
58      jQuery('#genotyping_data_project_result_names').html(names);
59      addToListMenu('genotyping_data_project_to_list_menu', 'genotyping_data_project_result_names', {
60        listType: 'trials'
61      });
63    });
65 });
67 </script>