Changeset 508 for Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js
- Timestamp:
- 03/12/14 02:23:11 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js
r500 r508 1 1 define([ 2 "../../../widgets/_ComplexValueWidget", 2 "dijit/_Container", 3 "dijit/_TemplatedMixin", 4 "dijit/_WidgetBase", 5 "dijit/_WidgetsInTemplateMixin", 3 6 "dijit/form/CheckBox", 4 7 "dijit/form/RadioButton", … … 7 10 "dojo/dom-construct", 8 11 "dojo/text!./templates/MultipleChoiceInputWidget.html" 9 ], function(_Co mplexValueWidget, CheckBox, RadioButton, array, declare, domConstruct, template) {10 return declare([_ ComplexValueWidget],{12 ], function(_Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, CheckBox, RadioButton, array, declare, domConstruct, template) { 13 return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{ 11 14 templateString: template, 12 allowMultiple: false,13 15 startup: function() { 14 16 if ( this._started ) { return; } … … 17 19 domConstruct.empty(this.domNode); 18 20 var Ctor = this.allowMultiple === true ? CheckBox : RadioButton; 19 array.forEach(this.items, function(item , index){21 array.forEach(this.items, function(item){ 20 22 var div = domConstruct.create("div", { 21 23 }, this.domNode, "last"); 22 24 var input = new Ctor({ 23 name: this. allowMultiple === true ? index.toString() : 'choice',24 value: item.text25 name: this.code + (this.allowMultiple === true ? item.subcode : ''), 26 value: this.allowMultiple === true ? null : item.subcode 25 27 }).placeAt(div); 26 28 var label = domConstruct.create("label",{ … … 29 31 }, div); 30 32 }, this); 31 },32 _getValueAttr: function() {33 var value = this.inherited(arguments);34 /*if ( this.allowMultiple === true ) {35 return value;36 } else {37 return value.choice; //.length > 0;38 }*/39 },40 _setValueAttr: function(value) {41 var inherited = this.getInherited(arguments);42 if ( this.allowMultiple === true ) {43 inherited.call(this,value);44 } else {45 inherited.call(this,{choice:value ? ["on"] : []});46 }47 33 } 48 34 });
Note: See TracChangeset
for help on using the changeset viewer.