Updated
This commit is contained in:
74
master/examples/test_mvc_input-output-simple.html
Normal file
74
master/examples/test_mvc_input-output-simple.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Static Master/Detail Pattern -- Multiple Address Detail example</title>
|
||||
<style type="text/css">
|
||||
@import "css/app-format.css";
|
||||
@import "../../../dijit/themes/claro/claro.css";
|
||||
</style>
|
||||
<script type="text/javascript" djConfig="parseOnLoad:1,isDebug:1,async:1" src="../../../dojo/dojo.js"></script>
|
||||
<script type="text/javascript">
|
||||
var model;
|
||||
|
||||
require([
|
||||
'dojo/parser',
|
||||
'dojox/mvc',
|
||||
'dijit/form/TextBox',
|
||||
'dijit/form/Button',
|
||||
'dojox/mvc/Group',
|
||||
'dojox/mvc/Output'
|
||||
], function(parser, mvc){
|
||||
// The dojox.mvc.StatefulModel class creates a data model instance
|
||||
// where each leaf within the data model is decorated with dojo.Stateful
|
||||
// properties that widgets can bind to and watch for their changes.
|
||||
model = mvc.newStatefulModel({ data : { "First" : "John", "Last" : "Doe", "Email" : "jdoe@example.com" }});
|
||||
// the StatefulModel created above is initialized with
|
||||
// model.First set to "John", model.Last set to "Doe" and model.Email set to "jdoe@example.com"
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="claro">
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<div id="navigation"></div>
|
||||
<div id="headerInsert">
|
||||
<h1>Input Ouput Sync</h1>
|
||||
<h2>Data Binding Example</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div id="leftNav"></div>
|
||||
<div id="mainContent">
|
||||
<div class="row">
|
||||
<label class="cell" for="firstnameInput">First:</label>
|
||||
<input class="cell" id="firstnameInput" data-dojo-type="dijit.form.TextBox"
|
||||
data-dojo-props="ref: model.First"></input>
|
||||
<!-- Content in output below will always be in sync with value of textbox above -->
|
||||
<span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model.First">
|
||||
(first name is: ${this.value})
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="cell" for="lastnameInput">Last:</label>
|
||||
<input class="cell" id="lastnameInput" data-dojo-type="dijit.form.TextBox"
|
||||
data-dojo-props="ref: model.Last"></input>
|
||||
<span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model.Last">
|
||||
(last name is: ${this.value})
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="cell" for="emailInput">Email:</label>
|
||||
<input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox"
|
||||
data-dojo-props="ref: model.Email"></input>
|
||||
<span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model.Email">
|
||||
(email is: ${this.value})
|
||||
</span>
|
||||
</div>
|
||||
<br/>Model:
|
||||
<button id="reset" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){model.reset();}">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user