Changeset 303 for Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
- Timestamp:
- 03/04/12 15:48:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
r292 r303 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/ store/JsonRest','dojo/data/ObjectStore','rft/content','rft/ui/_Page'],2 function(declare,lang, JsonRest,ObjectStore,content,_Page){1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/Deferred','dojo/data/ObjectStore','rft/auth','rft/store','rft/content','rft/ui/_Page'], 2 function(declare,lang,Deferred,ObjectStore,auth,store,content,_Page){ 3 3 return declare('rft.pages.surveys',[_Page],{ 4 4 selectedObject: null, 5 5 postCreate: function() { 6 this._store = new JsonRest({ 7 target:"../server/api.php/data/Survey/", 8 idProperty: 'uid' 9 }); 6 this._store = store.getStore('Survey'); 10 7 }, 11 8 onVisit: function() { … … 14 11 this.grid.on('rowclick',lang.hitch(this,function(evt){ 15 12 this.selectedObject = evt.grid.getItem(evt.rowIndex); 16 this.btnEdit.set('disabled',! !this.selectedObject);13 this.btnEdit.set('disabled',!this.selectedObject); 17 14 })); 18 15 19 16 this.grid.on('rowdblclick',lang.hitch(this,function(evt){ 20 17 var obj = evt.grid.getItem(evt.rowIndex); 21 content.goTo('/survey',{uid:obj. uid});18 content.goTo('/survey',{uid:obj.getUid()}); 22 19 })); 23 20 24 21 this.btnNew.on('click',lang.hitch(this,function(){ 25 this._store.add({},function(obj) { 26 content.goTo('/survey',{uid:this.selectedObject.uid}); 22 Deferred.when( this._store.add({'creator':auth.getUser()}) ) 23 .then(function(obj) { 24 content.goTo('/survey',{uid:obj.getUid()}); 27 25 }); 28 26 })); … … 30 28 this.btnEdit.on('click',lang.hitch(this,function(){ 31 29 if ( this.selectedObject ) { 32 content.goTo('/survey',{uid:this.selectedObject. uid});30 content.goTo('/survey',{uid:this.selectedObject.getUid()}); 33 31 } 34 32
Note: See TracChangeset
for help on using the changeset viewer.