Changeset 733
- Timestamp:
- Jul 27, 2010, 4:08:14 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r629 r733 140 140 "\$('" + attrs.get('form') + "')" 141 141 ) 142 } 143 144 // change 'this' if a this attribute is preset 145 if (attrs.get('this')) { 146 button = button.replace('this', attrs.get('this')) 142 147 } 143 148 -
trunk/grails-app/views/wizard/pages/_samples.gsp
r694 r733 29 29 </span> 30 30 31 <script type="text/javascript"> 32 function switchTemplate( element ) { 33 <wizard:ajaxSubmitJs functionName="switchTemplate" this="element" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()"/> 34 } 35 </script> 36 31 37 <g:if test="${samples}"> 32 38 <g:if test="${samples.size() > samplesWithTemplate}"> … … 46 52 <div class="firstColumn">${s+1}</div> 47 53 <div class="column"> 48 <wizard:templateSelect name="template_${s}" entity="${dbnp.studycapturing.Sample}" value="${sampleData['sample'].template}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" />54 <wizard:templateSelect name="template_${s}" entity="${dbnp.studycapturing.Sample}" value="${sampleData['sample'].template}" addDummy="true" tableEditorChangeEvent="switchTemplate(element);" /> 49 55 </div> 50 56 <wizard:templateColumns name="sample_${s}" class="column" id="1" entity="${sampleData.sample}"/> … … 75 81 <div class="firstColumn">${s+1}</div> 76 82 <div class="column"> 77 <wizard:templateSelect name="template_${s}" entity="${dbnp.studycapturing.Sample}" value="${sampleData['sample'].template}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" />83 <wizard:templateSelect name="template_${s}" entity="${dbnp.studycapturing.Sample}" value="${sampleData['sample'].template}" addDummy="true" tableEditorChangeEvent="switchTemplate(element);" /> 78 84 </div> 79 85 <wizard:templateColumns name="sample_${s}" class="column" id="1" entity="${sampleData.sample}"/> -
trunk/web-app/js/table-editor.js
r460 r733 97 97 // does this column contain an input field 98 98 if (input && type) { 99 // check field type 99 100 switch (type) { 100 101 case 'text': … … 123 124 inputElement.bind('change.tableEditor', function() { 124 125 that.updateSingleInputElements(input, columnNumber, 'select'); 126 127 // probably we want to bind these extra event handlers 128 // separately, but for now this will suffice :) 129 that.handleExtraEvents( inputElement ); 125 130 }); 126 131 break; … … 211 216 break; 212 217 } 218 }, 219 220 /** 221 * execute extra functions when binding to a particular event. The extra change 222 * handlers are called after replicating template fields 223 * example: <select ... tableEditorChangeEvent="console.log(element);" ... /> 224 * @param element 225 */ 226 handleExtraEvents: function( element ) { 227 // define parameters 228 var events = ['change']; 229 230 // check if we need to execute some more event handlers 231 for ( var i=0; i < events.length; i++ ) { 232 var call = element.attr('tableEditor' + events[ i ].substr(0, 1).toUpperCase() + events[ i ].substr(1).toLowerCase() + 'Event'); 233 if ( call ) { 234 // yes, execute! 235 eval( call ); 236 } 237 } 213 238 } 214 239 }
Note: See TracChangeset
for help on using the changeset viewer.