Changeset 404 for Dev/branches/rest-dojo-ui/client/rft/ui/content
- Timestamp:
- 09/03/12 13:37:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js
r402 r404 4 4 'dojo/_base/lang', 5 5 'dojo/dom-construct', 6 'dijit/_TemplatedMixin', 6 7 'dijit/_WidgetBase', 7 8 'dijit/_Container', … … 13 14 'dijit/form/TextBox', 14 15 'dojox/layout/TableContainer', 16 './../lists/_EditableListMixin', 15 17 './../lists/OrderedList' 16 ],function(array, declare, lang, domConstruct, _ WidgetBase, _Container, Button, CheckBox, NumberSpinner, RadioButton, Textarea, TextBox, TableContainer, OrderedList) {18 ],function(array, declare, lang, domConstruct, _TemplatedMixin, _WidgetBase, _Container, Button, CheckBox, NumberSpinner, RadioButton, Textarea, TextBox, TableContainer, _EditableListMixin, OrderedList) { 17 19 var factory = declare('rft.ui.content.ContentWidgetFactory', [], { 18 20 /* No default type, all should be valid */ … … 331 333 332 334 var ctor = this.options.multiple === true ? CheckBox : RadioButton; 333 array.forEach(this.options.items || ["Aap", "Noot"],function(item){335 array.forEach(this.options.items ,function(item){ 334 336 table.addChild(new ctor({ 335 title: item337 title: item 336 338 })); 337 339 },this); … … 362 364 }); 363 365 364 var MCOptionItem = declare([_WidgetBase,_Container],{ 366 var MCOptionItem = declare([_WidgetBase,_TemplatedMixin,_Container],{ 367 templateString: '<div><span class="dojoDndHandle">=</span></div>', 365 368 _textBox: null, 366 369 postCreate: function() { 367 this.innerHTML = '<span class="dojoDndHandle">=</span>';368 369 370 this._textBox = new TextBox({}); 370 371 this.addChild(this._textBox); … … 387 388 }); 388 389 390 var MCOptionList = declare([OrderedList,_EditableListMixin],{ 391 type: 'multipleChoiceOption', 392 withHandles: true, 393 _createAvatarNode: function(item){ 394 return domConstruct.create("div",{ 395 'class': 'dragAvatar', 396 innerHTML: item 397 }); 398 }, 399 _createListNode: function(item) { 400 var w = new MCOptionItem(); 401 w.startup(); 402 w.set('value',item); 403 w.on('delete',lang.hitch(this,'_onRemove',w)); 404 return w.domNode; 405 }, 406 _onRemove: function(w) { 407 w.destroyRecursive(); 408 this.removeCallback && this.removeCallback(item); 409 this.source.sync(); 410 } 411 }); 412 389 413 var MultipleChoiceInputEdit = declare([_WidgetBase, _Container], { 390 414 _codeInput: null, … … 412 436 add.startup(); 413 437 414 this._optionsList = new OrderedList({ 415 type: 'multipleChoiceOption', 416 withHandles: true, 417 _createAvatarNode: function(item){ 418 return domConstruct.create("div",{ 419 'class': 'dragAvatar', 420 innerHTML: item 421 }); 422 }, 423 _createListNode: function(item) { 424 var w = new MCOptionItem(); 425 w.startup(); 426 w.set('value',item); 427 w.on('delete',lang.hitch(this,function(){ 428 this._optionsList.removeItem(w); 429 })); 430 return w.domNode; 431 } 432 }); 438 this._optionsList = new MCOptionList(); 433 439 table.addChild(this._optionsList); 434 440 this._optionsList.startup(); … … 436 442 this.addChild(table); 437 443 table.startup(); 444 }, 445 446 _addOption: function() { 447 this._optionsList.appendItems([""]); 438 448 }, 439 449
Note: See TracChangeset
for help on using the changeset viewer.