Reset checked status when switching between lists
[sgn.git] / mason / pedigree / stock_pedigree_string.mas
blob94bf6e2aab9eb57cc2083a51321ecf2c033510e7
2 <%args>
3 $stock_id
4 </%args>
6 <&| /page/info_section.mas, title=>'Pedigree string' &>
7   <select id="pedigree_level_select">
8     <option value="Parents">Parents</option>
9     <option value="Grandparents">Grandparents</option>
10     <option value="Great-Grandparents">Great-Grandparents</option>
11   </select>
13   <span id="pedigree_string">[loading...]</span>
15   <br /><br />
16 </&>
18 <script>
20 jQuery(document).ready(function($) {
22   get_pedigree_string(<% $stock_id %>);
23   jQuery('#pedigree_level_select').change( function() {
24     jQuery('#pedigree_string').html('[loading...]');
25     get_pedigree_string(<% $stock_id %>);
26   });
27 });
29 function get_pedigree_string(stock_id) {
30     jQuery.ajax( {
31       url : '/stock/'+ stock_id +'/pedigreestring',
32       data : { 'level' : jQuery('#pedigree_level_select').val() },
33       error : function(response) {
34          alert("an error occurred");
35       },
36       success: function(response) {
37          jQuery('#pedigree_string').html(response.pedigree_string);
38       }
39     });
42 </script>