Changeset 2149
- Timestamp:
- Jan 24, 2012, 2:12:45 PM (10 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/generic/AjaxController.groovy
r2148 r2149 90 90 } 91 91 } 92 93 def studyCount = { 94 def result = [0:"0 studies found based on your criteria"]; 95 96 // set output header to json 97 response.contentType = 'application/json' 98 99 // render result 100 if (params.callback) { 101 render "${params.callback}(${result as JSON})" 102 } else { 103 render result as JSON 104 } 105 } 92 106 } -
trunk/grails-app/views/studyCompare/common/_on_page.gsp
r2146 r2149 27 27 // add waitForLoad class to ajax elements 28 28 $('.ajax').each(function() { 29 var that = this; 29 30 var element = $(this); 30 31 var elementId = this.getAttribute('id'); 31 32 element.addClass('waitForLoad'); 32 33 33 $.getJSON(baseUrl+"/ajax/"+elementId,{},function( j) {34 var options = ' ';35 for (var i=0;i< j.length;i++) {36 options += '<input type="checkbox" name="species[]" value="'+ j[i].id+'"/>'+j[i].name+'<br/>';34 $.getJSON(baseUrl+"/ajax/"+elementId,{},function(data) { 35 var options = '<h2>'+that.getAttribute('name')+'</h2>'; 36 for (var i=0;i<data.length;i++) { 37 options += '<input type="checkbox" name="species[]" value="'+data[i].id+'"/>'+data[i].name+'<br/>'; 37 38 } 38 39 element.removeClass('waitForLoad').html(options); 39 40 }); 40 41 41 }); 42 42 } -
trunk/grails-app/views/studyCompare/index.gsp
r2146 r2149 26 26 height: 30px; 27 27 } 28 .selector { 29 display: block; 30 } 31 .selector .ajax { 32 display: inline-block; 33 vertical-align: top; 34 } 35 .selector .ajax .label { 36 background-color: blue; 37 display: block; 38 } 39 28 40 </style> 29 41 </head> -
trunk/grails-app/views/studyCompare/pages/_page_one.gsp
r2148 r2149 13 13 %> 14 14 <af:page> 15 species: <div id="uniqueSpecies" class="ajax"></div> 16 unique event names: <div id="uniqueEventTemplateNames" class="ajax"></div> 17 unique sampling event names: <div id="uniqueSamplingEventTemplateNames" class="ajax"></div> 15 <div class="selector"> 16 <div name="species" id="uniqueSpecies" class="ajax"></div> 17 <div name="event templates" id="uniqueEventTemplateNames" class="ajax"></div> 18 <div name="sampling event templates" id="uniqueSamplingEventTemplateNames" class="ajax"></div> 19 </div> 20 <div class="ajax" id="studyCount"></div> 18 21 19 22 </af:page>
Note: See TracChangeset
for help on using the changeset viewer.