You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.4 KiB
150 lines
5.4 KiB
<!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> |
|
|
|
<script src="../../../dojo/dojo.js" |
|
type="text/javascript" |
|
data-dojo-config="parseOnLoad: true, isDebug: true, mvc: {debugBindings: true}"> |
|
</script> |
|
<style type="text/css"> |
|
@import "css/app-format.css"; |
|
@import "../../../dijit/themes/claro/claro.css"; |
|
</style> |
|
<script type="text/javascript" > |
|
dojo.require("dojox.mvc"); |
|
dojo.require("dojox.mvc.Output"); |
|
dojo.require("dojox.mvc.Group"); |
|
dojo.require("dojox.mvc.Repeat"); |
|
dojo.require("dijit.form.TextBox"); |
|
dojo.require("dijit.form.Button"); |
|
dojo.require("dojo.store.Memory"); |
|
dojo.require("dojo.parser"); |
|
|
|
|
|
var model1Data = |
|
[{ |
|
"Query" : "Engineers1", |
|
"Results" : [ |
|
{ |
|
"First" : "Anne1", |
|
"Last" : "Ackerman1" |
|
}, |
|
{ |
|
"First" : "Ben1", |
|
"Last" : "Beckham1" |
|
}, |
|
{ |
|
"First" : "Chad1", |
|
"Last" : "Chapman1" |
|
} |
|
] |
|
}]; |
|
var model2Data = |
|
[{ |
|
"Query" : "Engineers2", |
|
"Results" : [ |
|
{ |
|
"First" : "Anne2", |
|
"Last" : "Ackerman2" |
|
}, |
|
{ |
|
"First" : "Ben2", |
|
"Last" : "Beckham2" |
|
} |
|
] |
|
}]; |
|
var model3Data = |
|
[{ |
|
"Query" : "Engineers3", |
|
"Results" : [ |
|
{ |
|
"First" : "", |
|
"Last" : "" |
|
} |
|
] |
|
}]; |
|
|
|
var memStore1 = new dojo.store.Memory({data : model1Data}); |
|
var model1 = dojox.mvc.newStatefulModel({ store : memStore1 })[0]; |
|
var memStore2 = new dojo.store.Memory({data : model2Data}); |
|
var model2 = dojox.mvc.newStatefulModel({ store : memStore2 })[0]; |
|
var memStore3 = new dojo.store.Memory({data : model3Data}); |
|
var model3 = dojox.mvc.newStatefulModel({ store : memStore3 })[0]; |
|
</script> |
|
</head> |
|
<body class="claro"> |
|
<script type="dojo/require">at: "dojox/mvc/at"</script> |
|
<div id="wrapper"> |
|
<div id="header"> |
|
<div id="navigation"></div> |
|
<div id="headerInsert"> |
|
<h1>Input Output Sync</h1> |
|
<h2>Data Binding Example</h2> |
|
</div> |
|
</div> |
|
<div id="main"> |
|
<div id="leftNav"></div> |
|
<div id="mainContent"> |
|
<div class="row"> |
|
<button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('ref',model1);}">Swap Model1</button> |
|
<button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('ref',model2);}">Swap Model2</button> |
|
<button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('ref',model3);}">Swap Model3</button> |
|
</div> |
|
<div class="row"> |
|
<button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('target',model1Data);}">Swap Model1 data</button> |
|
<button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){console.log(model2Data);dijit.byId('outergroupId').set('target', model2Data);}">Swap Model2 data</button> |
|
<button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('target',model3Data);}">Swap Model3 data</button> |
|
</div> |
|
<div id="outergroupId" data-dojo-type="dojox.mvc.Group" data-dojo-props="target: model1"> |
|
<div id="repeatId" data-dojo-type="dojox.mvc.Repeat" |
|
data-dojo-props="children: at('rel:', 'Results')"> |
|
<div class="row" data-dojo-type="dojox.mvc.Group" |
|
data-dojo-props="target: at('rel:${this.index}')"> |
|
<label class="cell" for="nameInput${this.index}">Name:</label> |
|
<input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${this.index}" |
|
data-dojo-props="value: at('rel:First', 'value')"> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="row"> |
|
<span> |
|
Model1 Output is ==> |
|
</span> |
|
<span id="firstnameOutput10" data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model1.Results[0].First"> |
|
Name1 is "${this.value}" : |
|
</span> |
|
<span id="firstnameOutput11" data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model1.Results[1].First"> |
|
Name2 is "${this.value}" : |
|
</span> |
|
<span id="firstnameOutput12" data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model1.Results[2].First"> |
|
Name3 is "${this.value}" |
|
</span> |
|
</div> |
|
<div class="row"> |
|
<span> |
|
Model2 Output is ==> |
|
</span> |
|
<span id="firstnameOutput20" data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model2.Results[0].First"> |
|
Name1 is "${this.value}" : |
|
</span> |
|
<span id="firstnameOutput21" data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model2.Results[1].First"> |
|
Name2 is "${this.value}" |
|
</span> |
|
</div> |
|
<div class="row"> |
|
<span> |
|
Model3 Output is ==> |
|
</span> |
|
<span id="firstnameOutput30" data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: model3.Results[0].First"> |
|
Name1 is "${this.value}" |
|
</span> |
|
</div> |
|
<br/>Model: |
|
<button id="reset" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){model1.reset();model2.reset();model3.reset();}">Reset all</button> |
|
</div> |
|
</div> |
|
</div> |
|
</body> |
|
</html>
|
|
|