| 1 |
<!DOCTYPE html> |
| 2 |
<html > |
| 3 |
<head> |
| 4 |
|
| 5 |
<style type="text/css"> |
| 6 |
@import "../../../../dijit/themes/claro/claro.css"; |
| 7 |
</style> |
| 8 |
<script src="../../../../dojo/dojo.js" data-dojo-config='parseOnLoad: true, mvc: {debugBindings: true}'></script><script>var searchRecords; |
| 9 |
|
| 10 |
|
| 11 |
</script> |
| 12 |
<script> |
| 13 |
/* BEGIN .. js :: Things in this section have to be two tabs in */ |
| 14 |
|
| 15 |
require([ |
| 16 |
"dojo/parser", |
| 17 |
"dojo/_base/json", |
| 18 |
"dijit/form/Textarea", |
| 19 |
"dojox/mvc/Generate" |
| 20 |
], function(parser){ |
| 21 |
parser.parse(); |
| 22 |
}); |
| 23 |
|
| 24 |
/* END .. js :: */ |
| 25 |
</script> |
| 26 |
</head> |
| 27 |
<body class="claro"> |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
<script type="dojo/require">at: "dojox/mvc/at"</script> |
| 32 |
<div id="wrapper"> |
| 33 |
<div id="header"> |
| 34 |
<div id="navigation"></div> |
| 35 |
<div id="headerInsert"> |
| 36 |
<h1>View generation example</h1> |
| 37 |
<h2>Data Binding - Generate Container.</h2> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
<div id="main"> |
| 41 |
<div id="leftNav"></div> |
| 42 |
<div id="mainContent"> |
| 43 |
<h3>Model</h3> |
| 44 |
<div class="row"> |
| 45 |
<textarea id="textarea" class="cell" data-dojo-type="dijit/form/Textarea"> |
| 46 |
{ |
| 47 |
Serial: "360324", |
| 48 |
First: "John", |
| 49 |
Last: "Doe", |
| 50 |
Email: "[email protected]", |
| 51 |
Address: { |
| 52 |
Street: "123 Valley Rd", |
| 53 |
City: "Katonah", |
| 54 |
State: "NY", |
| 55 |
Zip: "10536" |
| 56 |
}, |
| 57 |
Phones: [ |
| 58 |
{ |
| 59 |
Areacode: "111", |
| 60 |
Local: "111-1111" |
| 61 |
},{ |
| 62 |
Areacode: "222", |
| 63 |
Local: "222-2222" |
| 64 |
} |
| 65 |
], |
| 66 |
Member: { |
| 67 |
Since: "2010", |
| 68 |
Type: "Gold" |
| 69 |
} |
| 70 |
} |
| 71 |
</textarea> |
| 72 |
</div> |
| 73 |
<h3>Generated View</h3> |
| 74 |
<div data-dojo-type="dojox/mvc/Generate" |
| 75 |
data-dojo-props="children: at('widget:textarea', 'value').direction(at.from).transform({format: dojo.fromJson}), idNameMapping: {String: 'view_t'}"></div> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
|
| 80 |
<p>In the above example, the Generate will create a view with a label and TextBox for each of the fields listed in the textarea, and any updates to the textarea will be cause the view to be updated when you tab out of the text area.</p> |
| 81 |
|
| 82 |
|
| 83 |
</body> |
| 84 |
</html> |