Debian Codegraph @

dojox/mvc/tests/docExamples/widgetListDeclarativeExample1.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html >
3 <head>
4
5 <style type="text/css">
6 @import "../../../../dijit/themes/claro/claro.css";
7 </style>
8 <style type="text/css">
9 /* BEGIN .. css :: Things in this section have to be two tabs in */
10
11 .row { width: 500px; display: inline-block; margin: 5px; }
12 .cell { width: 20%; display:inline-block; }
13
14 /* END .. css :: Things in this section have to be two tabs in */
15 </style>
16 <script src="../../../../dojo/dojo.js" data-dojo-config='parseOnLoad: true, mvc: {debugBindings: true}'></script><script>var searchRecords;
17
18 /* BEGIN .. js :: Things in this section have to be two tabs in */
19
20 require([
21 'dojo/parser',
22 'dojo/ready',
23 'dojox/mvc/getStateful',
24 'dijit/form/TextBox',
25 'dijit/form/Button',
26 'dojox/mvc/Group',
27 'dojox/mvc/WidgetList',
28 'dojox/mvc/Output'
29 ], function(parser, ready, getStateful){
30
31 // Initial data
32 var data = {
33 "identifier": "Serial",
34 "items": [
35 {
36 "Serial" : "A111",
37 "First" : "Anne",
38 "Last" : "Ackerman",
39 "Email" : "[email protected]"
40 },
41 {
42 "Serial" : "B111",
43 "First" : "Ben",
44 "Last" : "Beckham",
45 "Email" : "[email protected]"
46 },
47 {
48 "Serial" : "I111",
49 "First" : "Irene",
50 "Last" : "Ira",
51 "Email" : "[email protected]"
52 },
53 {
54 "Serial" : "J111",
55 "First" : "John",
56 "Last" : "Jacklin",
57 "Email" : "[email protected]"
58 }
59 ]
60 };
61
62 // The getStateful call will take json data and create make it Stateful
63 searchRecords = getStateful(data);
64 });
65
66 /* END .. js :: */
67
68 </script>
69 </head>
70 <body class="claro">
71 <!-- BEGIN .. html :: THINGS IN HERE START TWO TABS IN -->
72 <script type="dojo/require">at: "dojox/mvc/at"</script>
73 <div id="main">
74 <div data-dojo-type="dojox/mvc/Group"
75 data-dojo-props="target: searchRecords">
76 <!--
77 The WidgetList container denotes a templated UI that operates over
78 a collection of data records.
79 -->
80 <h4>Declarative WidgetList using data-mvc-child-type to create TextBox with data bound to the First name from the items: </h4>
81 <div data-dojo-type="dojox/mvc/WidgetList"
82 data-dojo-props="children: at('rel:', 'items')"
83 data-mvc-child-type="dijit/form/TextBox"
84 data-mvc-child-props="value: at(this.target, 'First'),
85 class: 'row'">
86 </div>
87 </div>
88 <h4>Declarative WidgetList using a dojox/mvc/InlineTemplate to create label with the Serial and a TextBox with data bound to the First name from the items: </h4>
89 <div data-dojo-type="dojox/mvc/WidgetList"
90 data-dojo-mixins="dojox/mvc/_InlineTemplateMixin"
91 data-dojo-props="children: at(searchRecords, 'items')">
92 <script type="dojox/mvc/InlineTemplate">
93 <div>
94 <span data-dojo-type="dijit/_WidgetBase"
95 data-dojo-props="value: at('rel:', 'Serial'),
96 _setValueAttr: {node: 'domNode',
97 type: 'innerText'}">
98 </span>:
99 <span data-dojo-type="dijit/form/TextBox"
100 data-dojo-props="value: at('rel:', 'First')"></span>
101 </div>
102 </script>
103 </div>
104 <p>Updates to either set of TextBoxes will be reflected in the other set when tabbing out of the field, since they are bound to the same model properties.
105 </div>
106 <!-- END .. html :: THINGS IN HERE START TWO TABS IN -->
107 </body>
108 </html>