Changeset 1445 for trunk/grails-app


Ignore:
Timestamp:
Jan 27, 2011, 1:43:36 PM (10 years ago)
Author:
s.h.sikkema@…
Message:

Rudimentary assay export functionality

Location:
trunk/grails-app
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/AssayController.groovy

    r1440 r1445  
    141141        Assay assay = Assay.get(params.assayId)
    142142
     143        // check if assay exists
    143144        if (!assay) {
    144145            flash.errorMessage = "No assay found with id: $params.assayId."
     
    159160        } catch (Exception e) {
    160161
    161             flash.errorMessage = e.toString()
     162            flash.errorMessage = e.cause?.message ?: e.message
    162163            redirect action: 'selectAssay'
    163164
  • trunk/grails-app/views/assay/selectAssay.gsp

    r1430 r1445  
    1414      function updateAssay(jsonData, selectID) {
    1515        var a = eval(jsonData);
    16         var sel = $('#'+selectID).empty()
     16        var sel = $('#'+selectID).empty();
    1717       
    1818        $(a).each(function(i, el){
    19           sel.append($("<option></option>").attr("value",el.id).text(el.name));
    20         });
     19          sel.append($("<option></option>").attr("value",el.id).text(el.name))
     20        })
    2121      }
     22
     23      $(document).ready(function(){
     24        // trigger change event to load assay based on currently selected study.
     25        // After pressing 'Back', the browser may use last selected study.
     26        $('#study').change()
     27
     28      })
    2229    </script>
    2330  </head>
     
    2734  </div>
    2835  <g:form name="assaySelect" action="exportAssayAsExcel">
    29     <g:select optionKey="id" optionValue="title" name="studyId" from="${userStudies}"
    30             onChange="${remoteFunction(controller:'study',action:'ajaxGetAssays',params:'\'id=\'+escape(this.value)',onComplete: 'updateAssay(XMLHttpRequest.responseText, \'assay\')')}"/>
    31     <g:select optionKey="id" name="assayId" id="assay" from="${assays}"/>
     36    <g:select optionKey="id" optionValue="title" name="studyId" from="${userStudies}" id="study"
     37      onChange="${remoteFunction(controller:'study',action:'ajaxGetAssays',params:'\'id=\'+escape(this.value)',onComplete: 'updateAssay(XMLHttpRequest.responseText, \'assay\')')}"/>
     38    <g:select optionKey="id" name="assayId" id="assay" from=""/>
     39    %{--<g:select optionKey="id" name="assayId" id="assay" from="${assays}"/>--}%
    3240    <g:submitButton name="submit" value="Submit"/>
    3341  </g:form>
Note: See TracChangeset for help on using the changeset viewer.