| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
<html> |
| 13 |
<head> |
| 14 |
<title>Sample Declarative Data Binding using ColumnWire</title> |
| 15 |
<style type="text/css"> |
| 16 |
@import "../../../../dijit/themes/tundra/tundra.css"; |
| 17 |
@import "../../../../dojo/resources/dojo.css"; |
| 18 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 19 |
@import "../TableContainer.css"; |
| 20 |
</style> |
| 21 |
|
| 22 |
<script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script> |
| 23 |
<script type="text/javascript"> |
| 24 |
dojo.require("dojo.parser"); |
| 25 |
dojo.require("dojox.wire.ml.Invocation"); |
| 26 |
dojo.require("dojox.wire.ml.DataStore"); |
| 27 |
dojo.require("dojox.wire.ml.Transfer"); |
| 28 |
|
| 29 |
dojo.require("dijit._Widget"); |
| 30 |
dojo.require("dijit._Templated"); |
| 31 |
dojo.require("dojo.data.ItemFileReadStore"); |
| 32 |
dojo.require("dojox.wire"); |
| 33 |
dojo.require("dojox.wire.demos.TableContainer"); |
| 34 |
|
| 35 |
//Toplevel JS Object to contain a few basics for us, such as the request to pass to the store and a stub onItem function |
| 36 |
// to trap on for triggering other events. |
| 37 |
dataHolder = { |
| 38 |
//Simple object definition to get all items and sort it by the attribute 'type'. |
| 39 |
request: {onItem: function(item){}, sort: [{attribute: "type"}]}, |
| 40 |
//Spot to store off data values as they're generated by the declarative binding. |
| 41 |
result: null |
| 42 |
}; |
| 43 |
</script> |
| 44 |
</head> |
| 45 |
|
| 46 |
<body class="tundra"> |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
<div dojoType="dojo.data.ItemFileReadStore" |
| 51 |
data-dojo-id="DataStore1" |
| 52 |
url="countries.json"> |
| 53 |
</div> |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
<div dojoType="dojox.wire.ml.Invocation" |
| 60 |
triggerEvent="onLoad" |
| 61 |
object="DataStore1" method="fetch" parameters="dataHolder.request"></div> |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
<div dojoType="dojox.wire.demos.TableContainer" data-dojo-id="r1" headers="Name,Location Type"></div> |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
<div dojoType="dojox.wire.ml.Action" |
| 78 |
trigger="dataHolder.request" triggerEvent="onItem"> |
| 79 |
<div dojoType="dojox.wire.ml.Transfer" |
| 80 |
source="arguments[0]" sourceStore="DataStore1" |
| 81 |
target="dataHolder.result"> |
| 82 |
<div dojoType="dojox.wire.ml.ColumnWire" attribute="name"></div> |
| 83 |
<div dojoType="dojox.wire.ml.ColumnWire" attribute="type"></div> |
| 84 |
</div> |
| 85 |
<div dojoType="dojox.wire.ml.Invocation" |
| 86 |
object="r1" method="addRow" parameters='dataHolder.result'> |
| 87 |
</div> |
| 88 |
</div> |
| 89 |
</body> |
| 90 |
</html> |