Debian Codegraph @

dojox/grid/tests/test_yahoo_search.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <title>dojox.grid.Grid - Yahoo Search Test</title>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
7 <style>
8 @import "../resources/Grid.css";
9 body {
10 font-size: 0.9em;
11 font-family: Geneva, Arial, Helvetica, sans-serif;
12 }
13 .grid {
14 height: 30em;
15 }
16
17 #info {
18 width: 700px;
19 }
20 </style>
21 <script type="text/javascript" src="../../../dojo/dojo.js"
22 data-dojo-config="isDebug:false, parseOnLoad: true"></script>
23 <script type="text/javascript">
24 dojo.require("dijit.dijit");
25 dojo.require("dojox.grid.DataGrid");
26 dojo.require("dojo.io.script");
27 dojo.require("dojox.rpc.Service");
28 dojo.require("dojox.data.ServiceStore");
29 dojo.require("dojo.parser");
30 </script>
31 <script type="text/javascript" src="yahooSearch.js"></script>
32 <script type="text/javascript">
33 var service = new dojox.rpc.Service(dojo.moduleUrl("dojox.rpc.SMDLibrary", "yahoo.smd"));
34 var store = new YahooStore({ service: service.webSearch });
35
36 var webLayout = [
37 {
38 noscroll: true,
39 cells: [
40 new dojox.grid.cells.RowIndex({ width: 3, styles: 'text-align: center;' })
41 ]
42 },
43 [
44 [
45 { name: 'Site', width: 30, field: 'ClickUrl', get: getLink, formatter: formatLink },
46 { name: 'Date', width: 10, field: 'ModificationDate', formatter: formatDate}
47 ],[
48 { name: 'Display Url', width: 30, field: 'Url', styles: 'color: green; size: small;' },
49 { name: 'Type', width: 10, field: 'MimeType', styles: ' font-style: italic; color: gray; size: small;'}
50 ],[
51 { name: 'Summary', width: 40, colSpan: 2, field: 'Summary' }
52 ]
53 ]
54 ];
55
56 // remove the height from the header image cell / row cells have a
57 // default height so there's less adjustment when thumb comes in.
58 beforeImageRow = function(inRowIndex, inSubRow) {
59 inSubRow[0][0].cellStyles = (inRowIndex == -1 ? '' : 'height: 100px;');
60 inSubRow[1][0].cellStyles = (inRowIndex == -1 ? '' : 'vertical-align: top; height: 75px;');
61 }
62
63 var imageLayout = [
64 {
65 noscroll: true,
66 cells: [
67 new dojox.grid.cells.RowIndex({ width: 3, styles: 'text-align: center;' })
68 ]
69 },
70 {
71 onBeforeRow: beforeImageRow,
72 cells: [
73 [
74 { name: 'Image', cellStyles: "height: 100px;", styles: "text-align: center;", width: 13, rowSpan: 2, field: 'Url', get: getImage },
75 { name: 'Title', cellStyles: "height: 10px;", width: 14, field: 'Title', get: getLink },
76 { name: 'Size', width: 8, field: 'FileSize', styles: "font-style: italic; text-align: center;" },
77 { name: 'Dimensions', width: 8, styles: "text-align: center;", get: getDimensions }
78 ],
79 [
80 { name: 'Summary', cellStyles: "vertical-align: top; height: 75px;", colSpan: 3, field: 'Summary' }
81 ]
82 ]
83 }
84 ];
85
86 // execute search
87 var lastLayoutType = webLayout;
88 doSearch = function(){
89 var value = dojo.byId("searchInput").value;
90 var web = dojo.byId('webRb').checked;
91 store.service = (web ? service.webSearch : service.imageSearch);
92 if(lastLayoutType != (web ? webLayout : imageLayout)){
93 grid.set('structure', web ? webLayout : imageLayout);
94 }
95 grid.filter({ query: value }, true);
96 }
97
98 dojo.addOnLoad(function(){
99 dojo.byId('webRb').checked = "checked";
100 dojo.query("#searchInput").onkeypress(function(e){
101 if(e.keyCode == dojo.keys.ENTER){ doSearch(); }
102 });
103 });
104
105 </script>
106 </head>
107 <body>
108 <div style="font-weight: bold; padding-bottom: 0.25em;">dojox.grid.Grid - Yahoo Search Test</div>
109 <div style="padding-bottom: 3px;">
110 <label><input id="webRb" type="radio" name="searchType" checked>Web</label>&nbsp;&nbsp;
111 <label><input id="imageRb" type="radio" name="searchType">Images</label>
112 </div>
113 <input id="searchInput" type="text" value="apple">&nbsp;&nbsp;
114 <button onclick="doSearch()">Search</button><br><br>
115 <div dojoType="dojox.grid.DataGrid"
116 data-dojo-id="grid" class="grid" id="grid"
117 autoWidth="true" structure="webLayout"
118 store="store" elasticView="1"
119 query="{ query: 'apple' }"
120 rowSelector="20px">
121 </div>
122 <br>
123 <div id="info">
124 <div id="rowCount" style="float: left"></div>
125 <div style="float: right">
126 <div id="sendInfo" style="text-align: right"></div>
127 <div id="receiveInfo" style="text-align: right"></div>
128 </div>
129 </div>
130 </body>
131 </html>