Debian Codegraph @

dojox/mvc/tests/doh/doh_mvc_search-results-repeat.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>MVC DOH Search Results Repeat Test</title>
6 <style>
7 @import "../../../../dojo/resources/dojo.css";
8 @import "../../../../dijit/tests/css/dijitTests.css";
9 @import "../css/app-format.css";
10 </style>
11 <link id="themeStyles" rel="stylesheet" href="../../../../dijit/themes/claro/claro.css"/>
12 <script src="../../../../dojo/dojo.js" type="text/javascript" data-dojo-config="isDebug: true, mvc: {debugBindings: true}"></script>
13 <script type="text/javascript" src="./helpers.js"></script>
14 <script type="text/javascript">
15
16 require([
17 "doh/runner",
18 "dojo/parser",
19 "dojo/when",
20 "dijit/registry",
21 "dojox/mvc/getStateful",
22 "dijit/form/Button",
23 "dijit/form/TextBox",
24 "dojox/mvc/_atBindingExtension",
25 "dojox/mvc/ListController",
26 "dojox/mvc/StatefulArray",
27 "dojox/mvc/Group",
28 "dojox/mvc/Output",
29 "dojox/mvc/Repeat",
30 "dojo/domReady!"
31 ], function(doh, parser, when, registry, getStateful){
32 function runTests(){
33 // should be able to verify all of the inputs
34 doh.register("Check initial values and bindings", [
35 {
36 name: "initial",
37 runTest: function(){
38 var name1, bind1, firstInput;
39 name1 = registry.byId("nameInput0");
40 if (name1) {
41 doh.is("Anne",name1.value,"name1.value should be set");
42 }
43
44 firstInput = registry.byId("firstInput");
45 if (firstInput) {
46 doh.is("Anne",firstInput.value,"firstInput.value should be set");
47 }
48 }
49 }
50 ]);
51
52 doh.register("select Ben", [
53 {
54 name: "testBen",
55 runTest: function(){
56 setDetailsContext(1);
57 var name1, bind1, firstInput;
58 name1 = registry.byId("nameInput1");
59 if (name1) {
60 doh.is("Ben",name1.get("value"),"name1.get(value) is wrong");
61 }
62
63 firstInput = registry.byId("firstInput");
64 if (firstInput) {
65 doh.is("Ben",firstInput.get("value"),"firstInput value is wrong");
66 firstInput.set("value","Benjamin");
67 doh.is("Benjamin",firstInput.get("value"),"firstInput value is wrong after update");
68 doh.is("Benjamin",name1.get("value"),"name1.get(value) is wrong after update");
69 }
70 }
71 }
72 ]);
73
74 doh.run();
75 }
76
77 when(parser.parse(), function(){
78 setDetailsContext = function(index){
79 var ctl = registry.byId("listCtl");
80 ctl.set("cursorIndex", index);
81 };
82
83 searchRecords = getStateful(
84 {
85 "Query" : "Engineers",
86 "Results" : [
87 {
88 "First" : "Anne",
89 "Last" : "Ackerman",
90 "Location": "NY",
91 "Office" : "1S76",
92 "Email" : "[email protected]",
93 "Tel" : "123-764-8237",
94 "Fax" : "123-764-8228"
95 },
96 {
97 "First" : "Ben",
98 "Last" : "Beckham",
99 "Location": "NY",
100 "Office" : "5N47",
101 "Email" : "[email protected]",
102 "Tel" : "123-764-8599",
103 "Fax" : "123-764-8600"
104 },
105 {
106 "First" : "Chad",
107 "Last" : "Chapman",
108 "Location": "CA",
109 "Office" : "1278",
110 "Email" : "[email protected]",
111 "Tel" : "408-764-8237",
112 "Fax" : "408-764-8228"
113 },
114 {
115 "First" : "David",
116 "Last" : "Durham",
117 "Location": "NJ",
118 "Office" : "C12",
119 "Email" : "[email protected]",
120 "Tel" : "514-764-8237",
121 "Fax" : "514-764-8228"
122 },
123 {
124 "First" : "Emma",
125 "Last" : "Eklof",
126 "Location": "NY",
127 "Office" : "4N76",
128 "Email" : "[email protected]",
129 "Tel" : "123-764-1234",
130 "Fax" : "123-764-4321"
131 },
132 {
133 "First" : "Fred",
134 "Last" : "Fisher",
135 "Location": "NJ",
136 "Office" : "V89",
137 "Email" : "[email protected]",
138 "Tel" : "514-764-8567",
139 "Fax" : "514-764-8000"
140 },
141 {
142 "First" : "George",
143 "Last" : "Garnett",
144 "Location": "NY",
145 "Office" : "7S11",
146 "Email" : "[email protected]",
147 "Tel" : "123-999-8599",
148 "Fax" : "123-999-8600"
149 },
150 {
151 "First" : "Hunter",
152 "Last" : "Huffman",
153 "Location": "CA",
154 "Office" : "6532",
155 "Email" : "[email protected]",
156 "Tel" : "408-874-8237",
157 "Fax" : "408-874-8228"
158 },
159 {
160 "First" : "Irene",
161 "Last" : "Ira",
162 "Location": "NJ",
163 "Office" : "F09",
164 "Email" : "[email protected]",
165 "Tel" : "514-764-6532",
166 "Fax" : "514-764-7300"
167 },
168 {
169 "First" : "John",
170 "Last" : "Jacklin",
171 "Location": "CA",
172 "Office" : "6701",
173 "Email" : "[email protected]",
174 "Tel" : "408-764-1234",
175 "Fax" : "408-764-4321"
176 }
177 ]
178 });
179
180 registry.byId("listCtl").set("model", searchRecords.Results);
181 runTests();
182 });
183 });
184 </script>
185 </head>
186 <body class="claro" style="width:100%;height:100%;margin:0;padding:0;">
187 <script type="dojo/require">at: "dojox/mvc/at"</script>
188 <span id="listCtl" data-dojo-type="dojox.mvc.ListController"
189 data-dojo-props="cursorIndex: 0"></span>
190 <div id="header">
191 <div id="navigation">
192 </div>
193 <div id="headerInsert">
194 <h1>Employee Search</h1>
195 <h2>Master Detail Example - With repeat container.</h2>
196 </div>
197 </div>
198 <div id="main">
199 <div id="leftNav">
200 </div>
201 <div id="mainContent">
202 <!--
203 The group container denotes some logical grouping of widgets and also serves
204 to establish a parent data binding context for its children.
205 The target attribute for the outermost container obtains the binding from the
206 "page scope" itself.
207 -->
208 <div>
209 <div id="searchBanner">Search Results for term: Engineers</div>
210
211 <!--
212 The repeat container denotes a templated UI that operates over a collection
213 of data records.
214 The UI can be customized for each iteration using properties such as
215 ${this.index} for the iteration index.
216 -->
217 <div data-dojo-type="dojox.mvc.Repeat"
218 data-dojo-props="children: at('widget:listCtl', 'model')">
219 <div class="row" data-dojo-type="dojox.mvc.Group"
220 data-dojo-props="target: at('rel:${this.index}')">
221 <label class="cell" for="nameInput${this.index}">Name:</label>
222 <input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${this.index}"
223 data-dojo-props="value: at('rel:', 'First')">
224 <button type="button" data-dojo-type="dijit.form.Button"
225 data-dojo-props="onClick: function(){setDetailsContext('${this.index}');}">Details</button>
226 </div>
227 </div>
228 <div class="spacer"></div>
229
230 <div data-dojo-type="dojox.mvc.Group"
231 data-dojo-props="target: at('widget:listCtl', 'cursor')">
232 <div class="row">
233 <div style="display: inline-block;" id="detailsBanner">Details for result index: </div>
234 <span class="cell" id="indexOutput" data-dojo-type="dojox.mvc.Output"
235 data-dojo-props="value: at('widget:listCtl', 'cursorIndex')"></span>
236 </div>
237 <div class="row">
238 <label class="cell" for="firstInput">First Name:</label>
239 <input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox"
240 data-dojo-props="value: at('rel:', 'First')">
241 </div>
242 <div class="row">
243 <label class="cell" for="lastInput">Last Name:</label>
244 <input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox"
245 data-dojo-props="value: at('rel:', 'Last')">
246 </div>
247 <div class="row">
248 <label class="cell" for="locationInput">Location:</label>
249 <input class="cell" id="locationInput" data-dojo-type="dijit.form.TextBox"
250 data-dojo-props="value: at('rel:', 'Location')">
251 </div>
252 <div class="row">
253 <label class="cell" for="officeInput">Office:</label>
254 <input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox"
255 data-dojo-props="value: at('rel:', 'Office')">
256 </div>
257 <div class="row">
258 <label class="cell" for="emailInput">Email:</label>
259 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox"
260 data-dojo-props="value: at('rel:', 'Email')">
261 </div>
262 <div class="row">
263 <label class="cell" for="telInput">Telephone:</label>
264 <input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox"
265 data-dojo-props="value: at('rel:', 'Tel')">
266 </div>
267 <div class="row">
268 <label class="cell" for="faxInput">Fax:</label>
269 <input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox"
270 data-dojo-props="value: at('rel:', 'Fax')">
271 </div>
272 </div>
273 </div>
274 </div>
275 </div>
276 </body>
277 </html>