Debian Codegraph @

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