Changeset 343 for Dev/branches/rest-dojo-ui/client/rft/ui
- Timestamp:
- 06/18/12 12:51:58 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client/rft/ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui/QuestionWidget.js
r305 r343 9 9 name: '', 10 10 value: null, 11 _ type: null,11 _scale: null, 12 12 _widgetCache: null, 13 13 constructor: function() { … … 18 18 postCreate: function() { 19 19 this._resetValue = this.value; 20 this. typeSelector.set('disabled', this.mode == 'edit');20 this.scaleSelector.set('disabled', this.mode == 'edit'); 21 21 }, 22 22 _setValueAttr: function(value) { 23 23 this.value = value; 24 this._onTypeChange(value. type || 'string');24 this._onTypeChange(value.scale || 'string'); 25 25 this.ourForm.set('value',value); 26 26 }, … … 30 30 return this.value; 31 31 }, 32 _onTypeChange: function( type) {33 if ( this._ type == type ) return;34 this._ type = type;35 domConstruct.empty(this. typeDetails);36 var widget = this._getTypeWidget( type);37 widget && widget.placeAt(this. typeDetails,'only');32 _onTypeChange: function(scale) { 33 if ( this._scale == scale ) return; 34 this._scale = scale; 35 domConstruct.empty(this.scaleDetails); 36 var widget = this._getTypeWidget(scale); 37 widget && widget.placeAt(this.scaleDetails,'only'); 38 38 }, 39 _getTypeWidget: function( type) {40 var widget = this._widgetCache[ type];39 _getTypeWidget: function(scale) { 40 var widget = this._widgetCache[scale]; 41 41 if (!widget) { 42 switch( type) {42 switch(scale) { 43 43 case 'string': 44 44 widget = new TextBox({ … … 59 59 name: 'answers', 60 60 mode: this.mode, 61 allowMultiple: type == 'multipleChoice'61 allowMultiple: scale == 'multipleChoice' 62 62 }); 63 63 break; 64 64 } 65 this._widgetCache[ type] = widget;65 this._widgetCache[scale] = widget; 66 66 } 67 67 return widget; -
Dev/branches/rest-dojo-ui/client/rft/ui/templates/QuestionWidget.html
r303 r343 12 12 </fieldset> 13 13 <fieldset> 14 <select data-dojo-type="dijit.form.Select" data-dojo-attach-point=" typeSelector" data-dojo-attach-event="onChange:_onTypeChange" name="type">14 <select data-dojo-type="dijit.form.Select" data-dojo-attach-point="scaleSelector" data-dojo-attach-event="onChange:_onTypeChange" name="scale"> 15 15 <option value="string" selected>String</option> 16 16 <option value="text">Text</option> … … 18 18 <option value="multipleChoice">Multiple choice</option> 19 19 </select> 20 <div data-dojo-attach-point=" typeDetails"></div>20 <div data-dojo-attach-point="scaleDetails"></div> 21 21 </fieldset> 22 22 </form>
Note: See TracChangeset
for help on using the changeset viewer.