Debian Codegraph @

dojox/mvc/tests/1.7/test_mvc_repeat-store-declarative-async.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 <title>Static Master/Detail Pattern -- Search Results example, using a store with save, commit and reset</title>
6
7 <script src="../../../../dojo/dojo.js"
8 type="text/javascript"
9 djConfig="parseOnLoad: false, isDebug: true">
10 </script>
11 <style type="text/css">
12 @import "css/app-format.css";
13 @import "../../../../dijit/themes/claro/claro.css";
14 </style>
15 <script type="text/javascript" >
16 dojo.require("dojox.mvc");
17 dojo.require("dojox.mvc.Group");
18 dojo.require("dojox.mvc.Repeat");
19 dojo.require("dijit.form.TextBox");
20 dojo.require("dijit.form.Button");
21 dojo.require("dojo.data.ItemFileWriteStore");
22 dojo.require("dojo.store.DataStore");
23 dojo.require("dojo.parser");
24
25 var results, selectedIndex = 0;
26
27 function setup() {
28 var storeNodes = dojo.byId("storeNodes");
29 // this is necessary to parse the declarative stores without parsing the rest of the html with the refs.
30 dojo.parser.parse(storeNodes);
31 // writeStore and dataStore are created declaratively in the html below.
32 var modelPromise = dojox.mvc.newStatefulModel({store: theDataStore});
33 modelPromise.then(function(model){
34 results = model;
35 var wrapperNodes = dojo.byId("wrapper");
36 dojo.parser.parse(wrapperNodes); // parse the part of the html with the refs
37 });
38 };
39
40 dojo.addOnLoad(setup);
41 </script>
42 </head>
43 <body class="claro" style="background-image: url(images/master_detail.png)">
44 <div id="storeNodes">
45 <div data-dojo-id="theWriteStore" data-dojo-type="dojo.data.ItemFileWriteStore" data-dojo-props="url: '../../../../dojox/mvc/tests/_data/mvcRepeatData.json'"></div>
46 <div data-dojo-id="theDataStore" data-dojo-type="dojo.store.DataStore" data-dojo-props="store: theWriteStore"></div>
47 </div>
48 <div id="wrapper">
49 <div id="header">
50 <div id="navigation">
51 </div>
52 <div id="headerInsert">
53 <h2>Master Detail Example - With repeat container, using a store, with save, commit and reset.</h2>
54 </div>
55 </div>
56 <div id="main">
57 <div id="leftNav">
58 </div>
59 <div id="mainContent">
60 <div id="searchBanner">Search Results for term: </div>
61 <!--
62 The repeat container denotes a templated UI that operates over a collection
63 of data records.
64 The UI can be customized for each iteration using properties such as
65 ${this.index} for the iteration index.
66 -->
67 <div id="repeatId" data-dojo-type="dojox.mvc.Repeat" data-dojo-props="ref: 'results'">
68 <div class="row" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: '${this.index}'">
69 <label class="cell" for="nameInput${this.index}">Name:</label>
70 <input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${this.index}" data-dojo-props="ref: 'First'"></input>
71 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){setDetailsContext('${this.index}');}">Details</button>
72 </div>
73 </div>
74 <div class="spacer"></div>
75
76 <div data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'results'">
77 <div id="detailsBanner">Details for selected index:</div>
78
79 <div id="detailsGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: '0'">
80 <div class="row">
81 <label class="cell" for="firstInput">First Name:</label>
82 <input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'First'"></input>
83 </div>
84 <div class="row">
85 <label class="cell" for="lastInput">Last Name:</label>
86 <input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Last'"></input>
87 </div>
88 <div class="row">
89 <label class="cell" for="locationInput">Location:</label>
90 <input class="cell" id="locationInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Location'"></input>
91 </div>
92 <div class="row">
93 <label class="cell" for="officeInput">Office:</label>
94 <input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Office'"></input>
95 </div>
96 <div class="row">
97 <label class="cell" for="emailInput">Email:</label>
98 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Email'"></input>
99 </div>
100 <div class="row">
101 <label class="cell" for="telInput">Telephone:</label>
102 <input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Tel'"></input>
103 </div>
104 <div class="row">
105 <label class="cell" for="faxInput">Fax:</label>
106 <input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Fax'"></input>
107 </div>
108 <div class="row">
109 <div class="spacer"></div>
110 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){console.log(results[selectedIndex].toPlainObject());results[selectedIndex].commit();}">Save Item</button>
111 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){console.log(results.toPlainObject());results.commit();;}">Commit All</button>
112 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){results.reset();}">Reset to last saved</button>
113 </div>
114 </div>
115 </div>
116 </div>
117 </div>
118 </div>
119 <script type="text/javascript">
120 // called to change the selected item
121 function setDetailsContext(index) {
122 selectedIndex = index;
123 var widget = dijit.byId("detailsGroup");
124 widget.set("ref", index);
125 };
126 </script>
127 </body>
128 </html>