source: Dev/branches/rest-dojo-ui/client/rft/pages/sessions.html @ 303

Last change on this file since 303 was 303, checked in by hendrikvanantwerpen, 13 years ago

[Server] Refactored model classes with some meta-programming. Specific classes only define their fields and inherit from class RdfObject?. Changes to handle the new model objects correctly.
[Client] Added rft/store module for uniform resource access. Removed dependencies on 'uid' field name. Added support for references without loading full object nor exposing uri.
[Client] Added reset() to QuestionWidget?.
[RDFAPI] Fixed PHP warning.

File size: 2.2 KB
Line 
1<div>
2    <script type="rft/method" data-rft-method="onVisit">
3        var that = this;
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){
7            var store = new JsonRest({
8                target:"../server/api.php/data/Session/",
9                idProperty: 'uid'
10            });
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                // mixin newObj in obj.
27                // store.put(newObj);
28                event.stop(evt);
29                return false;
30            });
31            that.btnSave.on('click',submitHandler);
32            that.form.on('submit',submitHandler);
33       
34        });
35    </script>
36    <div class="largeFrame" style="width: 400px;">
37        <div class="largeTitle">Sessions</div>
38        <div class="content">
39            <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>
40        </div>
41
42    </div>
43
44    <div class="largeFrame" style="width: 400px;">
45        <div class="largeTitle">Details</div>
46        <div>
47            <form data-dojo-type="dijit.form.Form" data-dojo-attach-point="form">
48                <fieldset>
49                    <label for="title" class="loginLabel">Title</label>
50                    <input data-dojo-type="dijit.form.TextBox" name="title" type="text" class="loginInput" />
51                </fieldset>
52                <button type="submit" data-dojo-type="dijit.form.Button" data-dojo-attach-point="btnSave">Save</button>
53            </form>
54        </div>
55    </div>
56
57</div>
Note: See TracBrowser for help on using the repository browser.