| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
<html> |
| 13 |
<head> |
| 14 |
<title>Sample declarative data binding</title> |
| 15 |
<style type="text/css"> |
| 16 |
|
| 17 |
@import "../../../../dojo/resources/dojo.css"; |
| 18 |
@import "../../../../dijit/themes/soria/soria.css"; |
| 19 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 20 |
@import "../TableContainer.css"; |
| 21 |
|
| 22 |
.splitView { |
| 23 |
width: 90%; |
| 24 |
height: 90%; |
| 25 |
overflow: hidden; |
| 26 |
} |
| 27 |
</style> |
| 28 |
|
| 29 |
<script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script> |
| 30 |
<script type="text/javascript"> |
| 31 |
dojo.require("dojo.parser"); |
| 32 |
dojo.require("dojox.wire.ml.Invocation"); |
| 33 |
dojo.require("dojox.wire.ml.DataStore"); |
| 34 |
dojo.require("dojox.wire.ml.Transfer"); |
| 35 |
|
| 36 |
dojo.require("dijit.layout.BorderContainer"); |
| 37 |
dojo.require("dijit.layout.ContentPane"); |
| 38 |
dojo.require("dijit.form.Button"); |
| 39 |
dojo.require("dijit.form.TextBox"); |
| 40 |
|
| 41 |
dojo.require("dojo.data.ItemFileReadStore"); |
| 42 |
dojo.require("dojox.wire"); |
| 43 |
dojo.require("dojox.wire.demos.TableContainer"); |
| 44 |
|
| 45 |
//Toplevel JS Object to contain a few basics for us, such as the request to pass to the store and a stub onItem function |
| 46 |
// to trap on for triggering other events. |
| 47 |
dataHolder = { |
| 48 |
//Simple object definition to get all items and sort it by the attribute 'type'. |
| 49 |
request: {query: {name: "*"}, onItem: function(item, req){}, sort: [{attribute: "type"}]}, |
| 50 |
//Spot to store off data values as they're generated by the declarative binding. |
| 51 |
result: null |
| 52 |
}; |
| 53 |
|
| 54 |
</script> |
| 55 |
</head> |
| 56 |
|
| 57 |
<body class="soria"> |
| 58 |
|
| 59 |
|
| 60 |
<div dojoType="dijit.layout.BorderContainer" |
| 61 |
gutters="true" |
| 62 |
design="sidebar" |
| 63 |
class="splitView"> |
| 64 |
<div dojoType="dijit.layout.ContentPane" region="left" style="width: 50%; overflow: auto;"> |
| 65 |
<font size="3"><b>Demo Searcher (Searches on Attribute 'name'):</b></font><br/><br/> |
| 66 |
<b>Usage:</b><br/> |
| 67 |
Enter the name you want to search the store for. Wildcards * (multiple character), and ? (single character), are allowed. |
| 68 |
<br/> |
| 69 |
<br/> |
| 70 |
<table style="width: 90%;"> |
| 71 |
<tr> |
| 72 |
<td align="left"> |
| 73 |
<div dojoType="dijit.form.Button" data-dojo-id="searchButton">Search Datastore</div> |
| 74 |
</td> |
| 75 |
<td align="right"> |
| 76 |
<div dojoType="dijit.form.TextBox" data-dojo-id="inputField" value="*" intermediateChanges="true"></div> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
</table> |
| 80 |
</div> |
| 81 |
<div dojoType="dijit.layout.ContentPane" region="right" style="width: 50%; overflow: auto;"> |
| 82 |
<div class="dataTable" dojoType="dojox.wire.demos.TableContainer" data-dojo-id="dataTable" headers="Name,Location Type"></div> |
| 83 |
</div> |
| 84 |
</div> |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
<div dojoType="dojo.data.ItemFileReadStore" |
| 90 |
data-dojo-id="DataStore1" |
| 91 |
url="countries.json"> |
| 92 |
</div> |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
<div dojoType="dojox.wire.ml.Action" |
| 99 |
trigger="searchButton" |
| 100 |
triggerEvent="onClick"> |
| 101 |
<div dojoType="dojox.wire.ml.Invocation" object="dataTable" method="clearTable"></div> |
| 102 |
<div dojoType="dojox.wire.ml.Invocation" object="DataStore1" method="fetch" parameters="dataHolder.request"></div> |
| 103 |
</div> |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
<div dojoType="dojox.wire.ml.Transfer" |
| 111 |
trigger="inputField" triggerEvent="onChange" |
| 112 |
source="inputField.textbox.value" |
| 113 |
target="dataHolder.request.query.name"> |
| 114 |
</div> |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
<div dojoType="dojox.wire.ml.Action" |
| 126 |
trigger="dataHolder.request" triggerEvent="onItem"> |
| 127 |
<div dojoType="dojox.wire.ml.Transfer" |
| 128 |
source="arguments[0]" sourceStore="DataStore1" |
| 129 |
target="dataHolder.result"> |
| 130 |
<div dojoType="dojox.wire.ml.ColumnWire" attribute="name"></div> |
| 131 |
<div dojoType="dojox.wire.ml.ColumnWire" attribute="type"></div> |
| 132 |
</div> |
| 133 |
<div dojoType="dojox.wire.ml.Invocation" |
| 134 |
object="dataTable" method="addRow" parameters='dataHolder.result'> |
| 135 |
</div> |
| 136 |
</div> |
| 137 |
</body> |
| 138 |
</html> |