Ignore:
Timestamp:
02/16/12 14:47:39 (13 years ago)
Author:
hendrikvanantwerpen
Message:
  • [Client] Finished page framework. See rft/ui/content.js or test files for details.
  • [Client] Allow login by pressing Enter.
  • [API] On exception include details in json response.
  • [Server Use Exceptions when save() fails, iso return values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/pages/sessions.html

    r260 r263  
    1 <div data-dojo-type="rft.ui.Page">
    2     <script type="dojo/method" data-dojo-event="init">
     1<div>
     2    <script type="rft/method" data-rft-method="onVisit">
    33        var that = this;
    4         require(['dojo/store/JsonRest','dojox/grid/DataGrid',
    5                 'dojo/data/ObjectStore','dojo/domReady!'],
    6         function(JsonRest,DataGrid,ObjectStore){
     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){
    77            var store = new JsonRest({
    88                target:"../server/api.php/data/Session/",
    99                idProperty: 'uid'
    1010            });
    11             var grid = new DataGrid({
    12                 store: ObjectStore({objectStore: store}),
    13                 autoWidth: true,
    14                 autoHeight: true,
    15                 structure: [
    16                         {name:"Title", field:"title", width: "200px"}
    17                 ]
    18             }, that.page_sessions_grid);
    19             grid.startup();
     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       
    2035        });
    2136    </script>
     
    2338        <div class="largeTitle">Sessions</div>
    2439        <div class="content">
    25             <div data-rft-attach-point="page_sessions_grid"></div>
     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>
     41        </div>
     42
     43    </div>
     44
     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>
    2655        </div>
    2756    </div>
Note: See TracChangeset for help on using the changeset viewer.