1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
---|
5 | <title>Dojo MVC Node Widget Test</title> |
---|
6 | |
---|
7 | <style type="text/css"> |
---|
8 | @import "../../../dijit/themes/claro/document.css"; |
---|
9 | @import "../../../dijit/tests/css/dijitTests.css"; |
---|
10 | |
---|
11 | .bgRed { |
---|
12 | background-color: red; |
---|
13 | } |
---|
14 | |
---|
15 | .bgGreen { |
---|
16 | background-color: green; |
---|
17 | } |
---|
18 | |
---|
19 | .bgBlue { |
---|
20 | background-color: blue; |
---|
21 | } |
---|
22 | |
---|
23 | .boldText { |
---|
24 | font-weight: Bold; |
---|
25 | } |
---|
26 | </style> |
---|
27 | |
---|
28 | <!-- required: a default dijit theme: --> |
---|
29 | <link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/> |
---|
30 | |
---|
31 | <script type="text/javascript"> |
---|
32 | require = { |
---|
33 | isDebug: 1, |
---|
34 | async: 1, |
---|
35 | mvc: {debugBindings: 1} |
---|
36 | }; |
---|
37 | </script> |
---|
38 | |
---|
39 | <!-- required: dojo.js --> |
---|
40 | <script type="text/javascript" src="../../../dojo/dojo.js"></script> |
---|
41 | |
---|
42 | <script type="text/javascript"> |
---|
43 | require([ |
---|
44 | "dojox", |
---|
45 | "dojo/Stateful", |
---|
46 | "dojo/parser", |
---|
47 | "dojox/mvc/parserExtension", |
---|
48 | "dojo/domReady!" |
---|
49 | ], function(dojox, Stateful, parser){ |
---|
50 | |
---|
51 | titleModel = new Stateful({value: "Foo"}); |
---|
52 | colorModel = new Stateful({value: "bgRed"}); |
---|
53 | boldTextModel = new Stateful({checked: false}); |
---|
54 | parser.parse(); |
---|
55 | }); |
---|
56 | </script> |
---|
57 | </head> |
---|
58 | <body class="claro"> |
---|
59 | <script type="dojo/require">at: "dojox/mvc/at"</script> |
---|
60 | <div> |
---|
61 | <div> |
---|
62 | Text: |
---|
63 | <span data-mvc-bindings="class: at(boldTextModel, 'checked').direction(at.from).transform({format: function(value){ return value ? 'boldText' : ''; }}), |
---|
64 | innerText: at(titleModel, 'value')"></span> |
---|
65 | </div> |
---|
66 | <div> |
---|
67 | Choose text from: |
---|
68 | <select type="combo" data-mvc-bindings="value: at(titleModel, 'value')"> |
---|
69 | <option value="Foo">Foo</option> |
---|
70 | <option value="Bar">Bar</option> |
---|
71 | </select> |
---|
72 | </div> |
---|
73 | </div> |
---|
74 | |
---|
75 | <div style="margin-top:8px;"> |
---|
76 | <div style="width:200px;height:200px;" data-mvc-bindings="class: at(colorModel, 'value')"></div> |
---|
77 | <div> |
---|
78 | Choose color from: |
---|
79 | <select type="combo" data-mvc-bindings="value: at(colorModel, 'value')"> |
---|
80 | <option value="bgRed">Red</option> |
---|
81 | <option value="bgGreen">Green</option> |
---|
82 | <option value="bgBlue">Blue</option> |
---|
83 | </select> |
---|
84 | </div> |
---|
85 | </div> |
---|
86 | |
---|
87 | <div style="margin-top:8px;"> |
---|
88 | The text should be bold: |
---|
89 | <input type="checkbox" data-mvc-bindings="checked: at(boldTextModel, 'checked')"> |
---|
90 | </div> |
---|
91 | </body> |
---|
92 | </html> |
---|