[263] | 1 | <div> |
---|
| 2 | <script type="rft/method" data-rft-method="onVisit"> |
---|
[260] | 3 | var that = this; |
---|
[263] | 4 | require(['dojo/_base/lang','dojo/_base/event','dojo/store/JsonRest','dojox/grid/DataGrid', |
---|
| 5 | Â Â Â Â 'dojo/data/ObjectStore','rft/content','dojo/domReady!'], |
---|
| 6 | function(lang,event,JsonRest,DataGrid,ObjectStore,content){ |
---|
[256] | 7 | var store = new JsonRest({ |
---|
| 8 | target:"../server/api.php/data/Session/", |
---|
| 9 | idProperty: 'uid' |
---|
| 10 | }); |
---|
[263] | 11 | |
---|
| 12 | that.grid.setStore(ObjectStore({objectStore: store})); |
---|
| 13 | |
---|
| 14 | that.grid.on('rowclick',lang.hitch(that,function(evt){ |
---|
| 15 | var obj = evt.grid.getItem(evt.rowIndex); |
---|
| 16 | this.form.set('value', obj); |
---|
| 17 | })); |
---|
| 18 | |
---|
| 19 | that.grid.on('rowdblclick',lang.hitch(that,function(evt){ |
---|
| 20 | var obj = evt.grid.getItem(evt.rowIndex); |
---|
| 21 | content.goTo('/session',{uid:obj.uid}); |
---|
| 22 | })); |
---|
| 23 | |
---|
| 24 | var submitHandler = lang.hitch(that,function(evt){ |
---|
| 25 | var newObj = this.form.get('value'); |
---|
| 26 | debugger; |
---|
| 27 | // mixin newObj in obj. |
---|
| 28 | // store.put(newObj); |
---|
| 29 | event.stop(evt); |
---|
| 30 | return false; |
---|
| 31 | }); |
---|
| 32 | that.btnSave.on('click',submitHandler); |
---|
| 33 | that.form.on('submit',submitHandler); |
---|
| 34 | |
---|
[256] | 35 | }); |
---|
| 36 | </script> |
---|
[260] | 37 | <div class="largeFrame" style="width: 400px;"> |
---|
[256] | 38 | <div class="largeTitle">Sessions</div> |
---|
| 39 | <div class="content"> |
---|
[263] | 40 | <div data-dojo-type="dojox.grid.DataGrid" data-dojo-props="autoWidth:true,autoHeight:true,structure:[{name:'Title',field:'title'}]" data-dojo-attach-point="grid"></div> |
---|
[256] | 41 | </div> |
---|
[263] | 42 | |
---|
[256] | 43 | </div> |
---|
| 44 | |
---|
[263] | 45 | <div class="largeFrame" style="width: 400px;"> |
---|
| 46 | <div class="largeTitle">Details</div> |
---|
| 47 | <div> |
---|
| 48 | <form data-dojo-type="dijit.form.Form" data-dojo-attach-point="form"> |
---|
| 49 | <fieldset> |
---|
| 50 | <label for="title" class="loginLabel">Title</label> |
---|
| 51 | <input data-dojo-type="dijit.form.TextBox" name="title" type="text" class="loginInput" /> |
---|
| 52 | </fieldset> |
---|
| 53 | <button type="submit" data-dojo-type="dijit.form.Button" data-dojo-attach-point="btnSave">Save</button> |
---|
| 54 | </form> |
---|
| 55 | </div> |
---|
| 56 | </div> |
---|
| 57 | |
---|
[256] | 58 | </div> |
---|