Changeset 288 for Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
- Timestamp:
- 02/24/12 16:09:22 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r281 r288 1 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/_base/event', 2 'dojo/_base/Deferred','dojo/ store/JsonRest','dijit/layout/ContentPane','dijit/TitlePane',2 'dojo/_base/Deferred','dojo/dom-construct','dojo/store/JsonRest','dijit/layout/ContentPane','dijit/TitlePane', 3 3 'rft/ui/_Page','rft/ui/LineWithActionsWidget'], 4 function(declare,lang,array,event,Deferred, JsonRest,ContentPane,TitlePane,_Page,LineWithActionsWidget) {4 function(declare,lang,array,event,Deferred,domConstruct,JsonRest,ContentPane,TitlePane,_Page,LineWithActionsWidget) { 5 5 return declare('rft.pages.questions',[_Page],{ 6 6 constructor: function() { … … 13 13 idProperty: 'uid' 14 14 }); 15 this._refresh( );15 this._refresh(true); 16 16 }, 17 _refresh: function( ) {17 _refresh: function(initial) { 18 18 Deferred.when( this._store.query() ).then(lang.hitch(this,function(results){ 19 19 array.forEach(results,lang.hitch(this,'_addQuestion')); 20 initial && this.accordion.selectChild(true); 20 21 })); 21 22 }, … … 50 51 var category = q.category || 'Unsorted'; 51 52 var widgets = this.accordion.getChildren(); 52 var containerWidget; 53 var lastIndex = 'last'; 53 var containerWidget = null; 54 var placeNode = this.accordion.domNode; 55 var placePos = 'last'; 54 56 array.some(widgets,lang.hitch(this,function(widget,idx) { 55 57 if ( widget.title == category ) { … … 57 59 return true; 58 60 } else if ( widget.title > category ) { 59 lastIndex = idx; 61 placeNode = widget.domNode; 62 placePos = "before"; 60 63 return true; 61 64 } … … 67 70 }); 68 71 containerWidget.startup(); 69 this.accordion.addChild(containerWidget,lastIndex);72 domConstruct.place(containerWidget.domNode,placeNode,placePos); 70 73 } 71 74 return containerWidget; … … 87 90 _editQuestion: function(question) { 88 91 this.questionForm.reset(); 89 this.questionForm.set('value',question);90 92 this.questionWidget.set('value',question); 91 93 this.questionDialog.show(); 92 94 }, 93 95 onSaveQuestion: function(evt) { 94 var value = this.questionForm.get('value'); 95 var subvalue = this.questionWidget.get('value'); 96 lang.mixin(value,subvalue); 96 var value = this.questionWidget.get('value'); 97 97 Deferred.when( this._store.put(value) ) 98 98 .then(lang.hitch(this,function(){
Note: See TracChangeset
for help on using the changeset viewer.