| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Dojox QueryReadStore+ComboBox Demo</title> |
| 5 | <style type="text/css"> |
| 6 | @import "../../../dijit/themes/tundra/tundra.css"; |
| 7 | @import "../../../dojo/resources/dojo.css"; |
| 8 | @import "../../../dijit/tests/css/dijitTests.css"; |
| 9 | </style> |
| 10 | |
| 11 | <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true"></script> |
| 12 | </head> |
| 13 | <body class="tundra"> |
| 14 | |
| 15 | <h1 class="testTitle">Dojox QueryReadStore + ComboBox demo</h1> |
| 16 | |
| 17 | <h2>Everything is created ONLY in markup</h2> |
| 18 | <div class="dijitContainer"> |
| 19 | <div style="float:left;"> |
| 20 | <div dojoType="dojox.data.QueryReadStore" |
| 21 | jsId="store1" |
| 22 | url="../tests/stores/QueryReadStore.php" |
| 23 | requestMethod="post"></div> |
| 24 | <div dojoType="dijit.form.ComboBox" id="cb1" store="store1" pageSize="10" autoComplete="false"></div> |
| 25 | <button dojoType="dijit.form.Button" onclick="dijit.byId('cb1').reset()">reset</button> |
| 26 | </div> |
| 27 | <div style="float:left; margin-left:5em;"> |
| 28 | var w = dijit.byId("cb1"); |
| 29 | <br /><input id="value1" type="text" /> = w.value |
| 30 | <br /><input id="itemId1" type="text" /> = w.item ? w.store.getValue(w.item, "id") : "-" |
| 31 | <br /><input id="displayedValue1" type="text" /> = w.attr("displayedValue") |
| 32 | <br /><input id="isValid1" type="text" /> = w.isValid() |
| 33 | <br /><button dojoType="dijit.form.Button" onclick="refresh1()">refresh</button> |
| 34 | </div> |
| 35 | </div> |
| 36 | |
| 37 | <script type="text/javascript"> |
| 38 | dojo.require("dojox.data.QueryReadStore"); |
| 39 | dojo.require("dijit.form.ComboBox"); |
| 40 | dojo.require("dijit.form.Button"); |
| 41 | |
| 42 | var w = null; |
| 43 | var refresh1 = function() { |
| 44 | dojo.byId("value1").value = w.value; |
| 45 | dojo.byId("itemId1").value = w.item ? w.store.getValue(w.item, "id") : "-"; |
| 46 | dojo.byId("displayedValue1").value = w.attr("displayedValue"); |
| 47 | dojo.byId("isValid1").value = w.isValid(); |
| 48 | }; |
| 49 | dojo.addOnLoad(function() { |
| 50 | w = dijit.byId("cb1"); |
| 51 | dojo.connect(w.domNode, "onkeyup", refresh1); |
| 52 | dojo.connect(w, "onBlur", refresh1); |
| 53 | dojo.connect(w, "onChange", refresh1); |
| 54 | refresh1(); |
| 55 | }); |
| 56 | </script> |
| 57 | </body> |
| 58 | </html> |