| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<style type="text/css"> |
| 6 |
@import "../../../dojo/resources/dojo.css"; |
| 7 |
@import "../../../dijit/themes/tundra/tundra.css"; |
| 8 |
@import "../../../dijit/themes/tundra/tundra_rtl.css"; |
| 9 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 10 |
@import "../../../dojox/grid/resources/tundraGrid.css"; |
| 11 |
</style> |
| 12 |
|
| 13 |
<title>Google Search Store with Grid</title> |
| 14 |
|
| 15 |
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script> |
| 16 |
<script type="text/javascript"> |
| 17 |
dojo.require("dojox.grid.DataGrid"); |
| 18 |
dojo.require("dijit.form.TextBox"); |
| 19 |
dojo.require("dijit.form.Button"); |
| 20 |
dojo.require("dojox.wire.ml.Invocation"); |
| 21 |
dojo.require("dojox.wire.ml.Transfer"); |
| 22 |
dojo.require("dojox.wire.ml.Action"); |
| 23 |
dojo.require("dojox.data.GoogleSearchStore"); |
| 24 |
|
| 25 |
var href = function(value) { |
| 26 |
return "<a href=\"" + value + "\" target=\"_blank\">" + value + "</a>"; |
| 27 |
} |
| 28 |
var layoutResults = [ |
| 29 |
[ |
| 30 |
{ name: "Title", field: "title", width: 10 }, |
| 31 |
{ name: "Summary", field: "content", width: "auto"}, |
| 32 |
{ name: "URL", field: "url", width: 20, formatter: href } |
| 33 |
] |
| 34 |
]; |
| 35 |
var newQuery = {text: 'dojo ajax' }; |
| 36 |
</script> |
| 37 |
</head> |
| 38 |
<body class="tundra" style="margin:20px;"> |
| 39 |
<h1>dojox.data.GoogleSearchStore:</h1> |
| 40 |
<i>Displays a list of results from a google query.</i> |
| 41 |
<div dojoType="dojox.data.GoogleSearchStore" jsId="googleStore"></div> |
| 42 |
<br> |
| 43 |
<br> |
| 44 |
<div dojoType="dijit.form.TextBox" id="searchText" value="dojo ajax"></div> |
| 45 |
<button dojoType="dijit.form.Button" id="searchButton">Search</button> |
| 46 |
<br> |
| 47 |
<br> |
| 48 |
<br> |
| 49 |
|
| 50 |
<div dojoType="dojox.grid.DataGrid" |
| 51 |
rowsPerPage="8" |
| 52 |
store="googleStore" |
| 53 |
structure="layoutResults" |
| 54 |
escapeHTMLInData="false" |
| 55 |
query="{ text: 'dojo ajax' }" |
| 56 |
jsId="grid" |
| 57 |
style="width: 800px; height: 500px;" |
| 58 |
> |
| 59 |
</div> |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
<div dojoType="dojox.wire.ml.Action" |
| 66 |
trigger="searchButton" |
| 67 |
triggerEvent="onClick"> |
| 68 |
<div dojoType="dojox.wire.ml.Transfer" source="searchText.value" target="newQuery.text"></div> |
| 69 |
<div dojoType="dojox.wire.ml.Invocation" object="grid" method="setQuery" parameters="newQuery"></div> |
| 70 |
</div> |
| 71 |
</body> |
| 72 |
</html> |