| 1 |
<!DOCTYPE html> |
| 2 |
<html style="width: 100%; height: 100%;"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Dojo Repeat Selection Test</title> |
| 6 |
|
| 7 |
<style type="text/css"> |
| 8 |
@import "../../../dijit/themes/dijit.css"; |
| 9 |
@import "../../../dijit/themes/claro/document.css"; |
| 10 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 11 |
@import "css/app-format.css"; |
| 12 |
</style> |
| 13 |
|
| 14 |
|
| 15 |
<link id="themeStyles" rel="stylesheet" |
| 16 |
href="../../../dijit/themes/claro/claro.css" /> |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 21 |
data-dojo-config="isDebug: true, async: true, mvc: {debugBindings: true}"></script> |
| 22 |
|
| 23 |
<script type="text/javascript"> |
| 24 |
require([ |
| 25 |
"dojo/parser", |
| 26 |
"dijit/registry", |
| 27 |
"dojox/mvc/getStateful", |
| 28 |
"dojox/mvc/_atBindingExtension", |
| 29 |
"dojox/mvc/ListController", |
| 30 |
"dojox/mvc/StatefulArray", |
| 31 |
"dojox/mvc/Group", |
| 32 |
"dojox/mvc/Output", |
| 33 |
"dojox/mvc/Repeat", |
| 34 |
"dijit/form/Button", |
| 35 |
"dijit/form/TextBox" |
| 36 |
], |
| 37 |
function(parser, registry, getStateful){ |
| 38 |
|
| 39 |
setDetailsContext=function(index){ |
| 40 |
var ctl=registry.byId("listCtl"); |
| 41 |
ctl.set("cursorIndex", index); |
| 42 |
}; |
| 43 |
|
| 44 |
searchRecords=getStateful({ |
| 45 |
"Query" : "Engineers", |
| 46 |
"Results" : [{ |
| 47 |
"First" : "Anne", |
| 48 |
"Last" : "Ackerman", |
| 49 |
"Location" : "NY", |
| 50 |
"Office" : "1S76", |
| 51 |
"Email" : "[email protected]", |
| 52 |
"Tel" : "123-764-8237", |
| 53 |
"Fax" : "123-764-8228" |
| 54 |
}, { |
| 55 |
"First" : "Ben", |
| 56 |
"Last" : "Beckham", |
| 57 |
"Location" : "NY", |
| 58 |
"Office" : "5N47", |
| 59 |
"Email" : "[email protected]", |
| 60 |
"Tel" : "123-764-8599", |
| 61 |
"Fax" : "123-764-8600" |
| 62 |
}, { |
| 63 |
"First" : "Chad", |
| 64 |
"Last" : "Chapman", |
| 65 |
"Location" : "CA", |
| 66 |
"Office" : "1278", |
| 67 |
"Email" : "[email protected]", |
| 68 |
"Tel" : "408-764-8237", |
| 69 |
"Fax" : "408-764-8228" |
| 70 |
}, { |
| 71 |
"First" : "David", |
| 72 |
"Last" : "Durham", |
| 73 |
"Location" : "NJ", |
| 74 |
"Office" : "C12", |
| 75 |
"Email" : "[email protected]", |
| 76 |
"Tel" : "514-764-8237", |
| 77 |
"Fax" : "514-764-8228" |
| 78 |
}, { |
| 79 |
"First" : "Emma", |
| 80 |
"Last" : "Eklof", |
| 81 |
"Location" : "NY", |
| 82 |
"Office" : "4N76", |
| 83 |
"Email" : "[email protected]", |
| 84 |
"Tel" : "123-764-1234", |
| 85 |
"Fax" : "123-764-4321" |
| 86 |
}, { |
| 87 |
"First" : "Fred", |
| 88 |
"Last" : "Fisher", |
| 89 |
"Location" : "NJ", |
| 90 |
"Office" : "V89", |
| 91 |
"Email" : "[email protected]", |
| 92 |
"Tel" : "514-764-8567", |
| 93 |
"Fax" : "514-764-8000" |
| 94 |
}, { |
| 95 |
"First" : "George", |
| 96 |
"Last" : "Garnett", |
| 97 |
"Location" : "NY", |
| 98 |
"Office" : "7S11", |
| 99 |
"Email" : "[email protected]", |
| 100 |
"Tel" : "123-999-8599", |
| 101 |
"Fax" : "123-999-8600" |
| 102 |
}, { |
| 103 |
"First" : "Hunter", |
| 104 |
"Last" : "Huffman", |
| 105 |
"Location" : "CA", |
| 106 |
"Office" : "6532", |
| 107 |
"Email" : "[email protected]", |
| 108 |
"Tel" : "408-874-8237", |
| 109 |
"Fax" : "408-874-8228" |
| 110 |
}, { |
| 111 |
"First" : "Irene", |
| 112 |
"Last" : "Ira", |
| 113 |
"Location" : "NJ", |
| 114 |
"Office" : "F09", |
| 115 |
"Email" : "[email protected]", |
| 116 |
"Tel" : "514-764-6532", |
| 117 |
"Fax" : "514-764-7300" |
| 118 |
}, { |
| 119 |
"First" : "John", |
| 120 |
"Last" : "Jacklin", |
| 121 |
"Location" : "CA", |
| 122 |
"Office" : "6701", |
| 123 |
"Email" : "[email protected]", |
| 124 |
"Tel" : "408-764-1234", |
| 125 |
"Fax" : "408-764-4321" |
| 126 |
}] |
| 127 |
}); |
| 128 |
|
| 129 |
parser.parse(); |
| 130 |
}); |
| 131 |
</script> |
| 132 |
</head> |
| 133 |
<body class="claro" |
| 134 |
style="width: 100%; height: 100%; margin: 0; padding: 0;"> |
| 135 |
<script type="dojo/require">at: "dojox/mvc/at"</script> |
| 136 |
<span id="listCtl" data-dojo-type="dojox.mvc.ListController" |
| 137 |
data-dojo-props="model: searchRecords.Results, cursorIndex: 0"></span> |
| 138 |
<div id="header"> |
| 139 |
<div id="navigation"></div> |
| 140 |
<div id="headerInsert"> |
| 141 |
<h1>Employee Search</h1> |
| 142 |
<h2>Master Detail Example - With repeat container.</h2> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
<div id="main"> |
| 146 |
<div id="leftNav"></div> |
| 147 |
<div id="mainContent"> |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
<div data-dojo-type="dojox.mvc.Group" |
| 155 |
data-dojo-props="target: searchRecords"> |
| 156 |
<div class="row"> |
| 157 |
<label class="cell" for="queryInput">Search for:</label> |
| 158 |
<input class="cell" id="queryInput" data-dojo-type="dijit.form.TextBox" |
| 159 |
data-dojo-props="value: at('rel:', 'Query')" /> |
| 160 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 161 |
data-dojo-props="onClick: function(){setSearchBanner();}">Search</button> |
| 162 |
</div> |
| 163 |
<div class="spacer"></div> |
| 164 |
|
| 165 |
<div id="searchBanner">Search Results for term: Engineers</div> |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
<div data-dojo-type="dojox.mvc.Repeat" |
| 174 |
data-dojo-props="children: at('rel:', 'Results')"> |
| 175 |
<div class="row" data-dojo-type="dojox.mvc.Group" |
| 176 |
data-dojo-props="target: at('rel:${this.index}')"> |
| 177 |
<label class="cell" for="nameInput${this.index}">Name:</label> |
| 178 |
<input class="cell" data-dojo-type="dijit.form.TextBox" |
| 179 |
id="nameInput${this.index}" |
| 180 |
data-dojo-props="value: at('rel:', 'First')"> |
| 181 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 182 |
data-dojo-props="onClick: function(){setDetailsContext('${this.index}');}">Details</button> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
<div class="spacer"></div> |
| 186 |
|
| 187 |
<div data-dojo-type="dojox.mvc.Group" |
| 188 |
data-dojo-props="target: at('widget:listCtl', 'cursor')"> |
| 189 |
<div class="row"> |
| 190 |
<div style="display: inline-block;" id="detailsBanner">Details for result index:</div> |
| 191 |
<span class="cell" id="indexOutput" |
| 192 |
data-dojo-type="dojox.mvc.Output" |
| 193 |
data-dojo-props="value: at('widget:listCtl', 'cursorIndex')"></span> |
| 194 |
</div> |
| 195 |
<div class="row"> |
| 196 |
<label class="cell" for="firstInput">First Name:</label> |
| 197 |
<input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox" |
| 198 |
data-dojo-props="value: at('rel:', 'First')"> |
| 199 |
</div> |
| 200 |
<div class="row"> |
| 201 |
<label class="cell" for="lastInput">Last Name:</label> |
| 202 |
<input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox" |
| 203 |
data-dojo-props="value: at('rel:', 'Last')"> |
| 204 |
</div> |
| 205 |
<div class="row"> |
| 206 |
<label class="cell" for="locationInput">Location:</label> |
| 207 |
<input class="cell" id="locationInput" |
| 208 |
data-dojo-type="dijit.form.TextBox" |
| 209 |
data-dojo-props="value: at('rel:', 'Location')"> |
| 210 |
</div> |
| 211 |
<div class="row"> |
| 212 |
<label class="cell" for="officeInput">Office:</label> |
| 213 |
<input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox" |
| 214 |
data-dojo-props="value: at('rel:', 'Office')"> |
| 215 |
</div> |
| 216 |
<div class="row"> |
| 217 |
<label class="cell" for="emailInput">Email:</label> |
| 218 |
<input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" |
| 219 |
data-dojo-props="value: at('rel:', 'Email')"> |
| 220 |
</div> |
| 221 |
<div class="row"> |
| 222 |
<label class="cell" for="telInput">Telephone:</label> |
| 223 |
<input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox" |
| 224 |
data-dojo-props="value: at('rel:', 'Tel')"> |
| 225 |
</div> |
| 226 |
<div class="row"> |
| 227 |
<label class="cell" for="faxInput">Fax:</label> |
| 228 |
<input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox" |
| 229 |
data-dojo-props="value: at('rel:', 'Fax')"> |
| 230 |
</div> |
| 231 |
</div> |
| 232 |
</div> |
| 233 |
</div> |
| 234 |
</div> |
| 235 |
</body> |
| 236 |
</html> |