Debian Codegraph @

dojox/mvc/tests/WidgetList_tests/test_mvc_search-results-ins-del.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</title>
6 <script src="../../../../dojo/dojo.js" type="text/javascript"
7 data-dojo-config="parseOnLoad: 0, isDebug: true, mvc: {debugBindings: true}">
8 </script>
9 <style type="text/css">
10 @import "../css/app-format.css";
11 @import "../../../../dijit/themes/claro/claro.css";
12 </style>
13 <script type="text/javascript">
14 var data = [
15 {
16 id: "1",
17 Group: "Engineer",
18 First: "Anne",
19 Last: "Ackerman",
20 Location: "NY",
21 Office: "1S76",
22 Email: "[email protected]",
23 Tel: "123-764-8237",
24 Fax: "123-764-8228"
25 },
26 {
27 id: "2",
28 Group: "Engineer",
29 First: "Ben",
30 Last : "Beckham",
31 Location: "NY",
32 Office: "5N47",
33 Email: "[email protected]",
34 Tel: "123-764-8599",
35 Fax: "123-764-8600"
36 },
37 {
38 id: "3",
39 Group: "Engineer",
40 First: "Chad",
41 Last: "Chapman",
42 Location: "CA",
43 Office: "1278",
44 Email: "[email protected]",
45 Tel: "408-764-8237",
46 Fax: "408-764-8228"
47 },
48 {
49 id: "4",
50 Group: "Engineer",
51 First: "David",
52 Last: "Durham",
53 Location: "NJ",
54 Office: "C12",
55 Email: "[email protected]",
56 Tel: "514-764-8237",
57 Fax: "514-764-8228"
58 },
59 {
60 id: "5",
61 Group: "Engineer",
62 First: "Emma",
63 Last: "Eklof",
64 Location: "NY",
65 Office: "4N76",
66 Email: "[email protected]",
67 Tel: "123-764-1234",
68 Fax: "123-764-4321"
69 },
70 {
71 id: "6",
72 Group: "Manager",
73 First: "Fred",
74 Last: "Fisher",
75 Location: "NJ",
76 Office: "V89",
77 Email: "[email protected]",
78 Tel: "514-764-8567",
79 Fax: "514-764-8000"
80 },
81 {
82 id: "7",
83 Group: "Manager",
84 First: "George",
85 Last: "Garnett",
86 Location: "NY",
87 Office: "7S11",
88 Email: "[email protected]",
89 Tel: "123-999-8599",
90 Fax: "123-999-8600"
91 },
92 {
93 id: "8",
94 Group: "Accountant",
95 First: "Hunter",
96 Last: "Huffman",
97 Location: "CA",
98 Office: "6532",
99 Email: "[email protected]",
100 Tel: "408-874-8237",
101 Fax: "408-874-8228"
102 },
103 {
104 id: "9",
105 Group: "Accountant",
106 First: "Irene",
107 Last: "Ira",
108 Location: "NJ",
109 Office: "F09",
110 Email: "[email protected]",
111 Tel: "514-764-6532",
112 Fax: "514-764-7300"
113 },
114 {
115 id: "10",
116 Group: "Accountant",
117 First: "John",
118 Last: "Jacklin",
119 Location: "CA",
120 Office: "6701",
121 Email: "[email protected]",
122 Tel: "408-764-1234",
123 Fax: "408-764-4321"
124 }
125 ], ctrl;
126
127 require([
128 "dojo/_base/declare",
129 "dojo/when",
130 "dojo/parser",
131 "dojo/Stateful",
132 "dojo/store/Memory",
133 "dojox/mvc/EditStoreRefListController",
134 "dijit/form/Button",
135 "dijit/form/TextBox",
136 "dijit/form/ComboBox",
137 "dojox/mvc/Group",
138 "dojox/mvc/Output",
139 "dojox/mvc/Templated",
140 "dojox/mvc/WidgetList",
141 "dojo/domReady!"
142 ], function(declare, when, parser, Stateful, Memory, EditStoreRefListController){
143
144 var inited,
145 ctrlClass = declare([EditStoreRefListController], {
146 cursorIndex: 0,
147 group: "",
148 groupTyped: "",
149 _refModelProp: "model",
150
151 addEmpty: function(){
152 this.model.push(new Stateful({id:Math.random(), Group: this.groupTyped, First: "", Last: "", Location: "", Office: "", Email: "", Tel: "", Fax: ""}));
153 this.set("cursorIndex", this.get("length") - 1);
154 },
155
156 remove: function(idx){
157 this.model.splice(idx, 1);
158 if(this.get("cursorIndex") < 0){
159 this.set("cursorIndex", this.get("length") - 1);
160 }
161 },
162
163 _setGroupAttr: function(value){
164 this.set("groupTyped", value);
165 var old = this.group;
166 if(old === value){ return; }
167 when(this.queryStore({Group: value}), function(){
168 if(!inited){
169 parser.parse();
170 inited = true;
171 }
172 });
173 this._set("group", value);
174 }
175 });
176
177 ctrl = new ctrlClass({store: new Memory({data: data})});
178 ctrl.set("group", "Engineer");
179 });
180 </script>
181 </head>
182 <body class="claro" style="background-image: url(../images/master_detail.png)">
183 <script type="dojo/require">at: "dojox/mvc/at"</script>
184 <div id="wrapper">
185 <div id="header">
186 <div id="navigation"></div>
187 <div id="headerInsert">
188 <h1>Employee Search</h1>
189 <h2>Master Detail Example - Repeat with insert and delete.</h2>
190 </div>
191 </div>
192 <div id="main">
193 <div id="leftNav"></div>
194 <div id="mainContent">
195 <div class="row">
196 <div class="spacer"></div>
197 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){ ctrl.commit(); }">Commit All</button>
198 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){ ctrl.reset(); }">Reset to last saved</button>
199 </div>
200 <div class="spacer"></div>
201 <div>
202 Try "Engineer", "Manager", or "Accountant":
203 </div>
204 <div class="row">
205 <label class="cell" for="queryInput">Search for:</label>
206 <!-- <input class="cell" id="queryInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at(ctrl, 'groupTyped')"> -->
207 <select id="setvaluetest" data-dojo-type="dijit.form.ComboBox" data-dojo-props="value: at(ctrl, 'groupTyped')">
208 <option value="Engineer">Engineer</option>
209 <option value="Manager">Manager</option>
210 <option value="Accountant">Accountant</option>
211 </select>
212 <button type="button" data-dojo-type="dijit.form.Button"
213 data-dojo-props="onClick: function(){ ctrl.set('group', ctrl.get('groupTyped')); }">Search</button>
214 </div>
215 <div class="spacer"></div>
216 <div id="searchBanner">
217 Search Results for group: <span data-dojo-type="dojox.mvc.Output" data-dojo-props="value: at(ctrl, 'group')"></span>
218 </div>
219 <!--
220 <div data-dojo-type="dojox.mvc.Repeat" data-dojo-props="children: at(ctrl, 'model')">
221 <div class="row" data-dojo-type="dijit._WidgetBase" data-dojo-props="target: at('rel:', ${this.index})">
222 <label class="cell" for="nameInput${this.index}">Name:</label>
223 <input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${this.index}"
224 data-dojo-props="value: at('rel:', 'First')">
225 <button type="button" data-dojo-type="dijit.form.Button"
226 data-dojo-props="onClick: function(){ ctrl.set('cursorIndex', ${this.index}); }">Details</button>
227 <button type="button" data-dojo-type="dijit.form.Button"
228 data-dojo-props="onClick: function(){ ctrl.addEmpty(); }">+</button>
229 <button type="button" data-dojo-type="dijit.form.Button"
230 data-dojo-props="onClick: function(){ ctrl.remove(${index}); }">-</button>
231 </div>
232 </div>
233
234
235 <button type="button" data-dojo-type="dijit.form.Button"
236 data-dojo-props="onClick: function(){ ctrl.addEmpty(); }">+</button>
237 <button type="button" data-dojo-type="dijit.form.Button"
238 data-dojo-props="onClick: function(){ ctrl.remove(${index}); }">-</button>
239
240 -->
241
242 <div data-dojo-type="dojox/mvc/WidgetList"
243 data-dojo-mixins="dojox/mvc/_InlineTemplateMixin"
244 data-dojo-props="children: at(ctrl, 'model')">
245 <script type="dojox/mvc/InlineTemplate">
246 <div>
247 <label class="cell" for="nameInput${indexAtStartup}">Name:</label>
248 <input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${indexAtStartup}"
249 data-dojo-props="value: at('rel:', 'First')">
250 <button type="button" data-dojo-type="dijit.form.Button"
251 data-dojo-props="onClick: function(){ ctrl.set('cursorIndex', ${indexAtStartup}); }">Details</button>
252 <button type="button" data-dojo-type="dijit.form.Button"
253 data-dojo-props="onClick: function(){ ctrl.addEmpty(); }">+</button>
254 <button type="button" data-dojo-type="dijit.form.Button"
255 data-dojo-props="onClick: function(){ ctrl.remove(${indexAtStartup}); }">-</button>
256 </div>
257 </script>
258 </div>
259
260 <div class="spacer"></div>
261 <div id="detailsBanner">
262 Details for result index:
263 <span data-dojo-type="dojox.mvc.Output" data-dojo-props="value: at(ctrl, 'cursorIndex')"></span>
264 </div>
265 <div id="detailsGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="target: at(ctrl, 'cursor')">
266 <div class="row">
267 <label class="cell" for="firstInput">First Name:</label>
268 <input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'First')">
269 </div>
270 <div class="row">
271 <label class="cell" for="lastInput">Last Name:</label>
272 <input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Last')">
273 </div>
274 <div class="row">
275 <label class="cell" for="locationInput">Location:</label>
276 <input class="cell" id="locationInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Location')">
277 </div>
278 <div class="row">
279 <label class="cell" for="officeInput">Office:</label>
280 <input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Office')">
281 </div>
282 <div class="row">
283 <label class="cell" for="emailInput">Email:</label>
284 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Email')">
285 </div>
286 <div class="row">
287 <label class="cell" for="telInput">Telephone:</label>
288 <input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Tel')">
289 </div>
290 <div class="row">
291 <label class="cell" for="faxInput">Fax:</label>
292 <input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Fax')">
293 </div>
294 </div>
295 </div>
296 </div>
297 </div>
298 </body>
299 </html>