1 | <!doctype html> |
---|
2 | <html lang="en"> |
---|
3 | <head> |
---|
4 | <title>Grid - Datasources</title> |
---|
5 | <meta charset="utf-8" /> |
---|
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
---|
7 | <meta name="description" content="" /> |
---|
8 | <meta name="keywords" content="" /> |
---|
9 | <meta name="author" content="ComponentOne" /> |
---|
10 | |
---|
11 | <link href="../../themes/rocket/jquery-wijmo.css" rel="stylesheet" type="text/css" /> |
---|
12 | <link href="../../themes/wijmo/jquery.wijmo-open.2.2.2.css" rel="stylesheet" type="text/css" /> |
---|
13 | <link href="../../themes/wijmo/jquery.wijmo.wijgrid.css" rel="stylesheet" type="text/css" /> |
---|
14 | |
---|
15 | <script src="../../external/jquery-1.8.0.min.js" type="text/javascript"></script> |
---|
16 | <script src="../../external/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script> |
---|
17 | <script src="../../external/globalize.min.js" type="text/javascript"></script> |
---|
18 | <script src="../../external/jquery.mousewheel.min.js" type="text/javascript"></script> |
---|
19 | |
---|
20 | <script src="../../external/jquery.wijmo-open.all.2.2.2.min.js" type="text/javascript"></script> |
---|
21 | <script src="../../wijmo/jquery.wijmo.wijdatasource.js" type="text/javascript"></script> |
---|
22 | <script src="../../wijmo/jquery.wijmo.wijgrid.js" type="text/javascript"></script> |
---|
23 | |
---|
24 | <style type="text/css"> |
---|
25 | .wijmo-wijgrid |
---|
26 | { |
---|
27 | min-height: 100px; |
---|
28 | } |
---|
29 | </style> |
---|
30 | |
---|
31 | <script id="scriptInit" type="text/javascript"> |
---|
32 | $(document).ready(function () { |
---|
33 | // dom |
---|
34 | $("#demo-dom").wijgrid(); |
---|
35 | |
---|
36 | // array |
---|
37 | $("#demo-array").wijgrid({ |
---|
38 | data: [ |
---|
39 | ["ANATR", "Ana Trujillo Emparedados y helados", "Ana Trujillo"], |
---|
40 | ["ANTON", "Antonio Moreno Taqueria", "Antonio Moreno"], |
---|
41 | ["AROUT", "Around the Horn", "Thomas Hardy"], |
---|
42 | ["BERGS", "Berglunds snabbkop", "Christina Berglund"] |
---|
43 | ], |
---|
44 | columns: [ |
---|
45 | { headerText: "ID" }, { headerText: "Company" }, { headerText: "Name" } |
---|
46 | ] |
---|
47 | }); |
---|
48 | |
---|
49 | // hash |
---|
50 | $("#demo-hash").wijgrid({ |
---|
51 | data: [ |
---|
52 | { ID: "ANATR", Company: "Ana Trujillo Emparedados y helados", Name: "Ana Trujillo" }, |
---|
53 | { ID: "ANTON", Company: "Antonio Moreno Taqueria", Name: "Antonio Moreno" }, |
---|
54 | { ID: "AROUT", Company: "Around the Horn", Name: "Thomas Hardy" }, |
---|
55 | { ID: "BERGS", Company: "Berglunds snabbkop", Name: "Christina Berglund" } |
---|
56 | ] |
---|
57 | }); |
---|
58 | |
---|
59 | // remote |
---|
60 | $("#demo-remote").wijgrid({ |
---|
61 | data: new wijdatasource({ |
---|
62 | proxy: new wijhttpproxy({ |
---|
63 | url: "http://ws.geonames.org/searchJSON", |
---|
64 | dataType: "jsonp", |
---|
65 | data: { |
---|
66 | featureClass: "P", |
---|
67 | style: "full", |
---|
68 | maxRows: 5, |
---|
69 | name_startsWith: "ab" |
---|
70 | }, |
---|
71 | key: "geonames" |
---|
72 | }), |
---|
73 | reader: new wijarrayreader([ |
---|
74 | { name: "label", mapping: function (item) { return item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName } }, |
---|
75 | { name: "name", mapping: "name" }, |
---|
76 | { name: "countryCode", mapping: "countryCode" }, |
---|
77 | { name: "continentCode", mapping: "continentCode" } |
---|
78 | ]) |
---|
79 | }) |
---|
80 | }); |
---|
81 | }); |
---|
82 | </script> |
---|
83 | </head> |
---|
84 | <body class="demo-single"> |
---|
85 | <div class="container"> |
---|
86 | <div class="header"> |
---|
87 | <h2> |
---|
88 | Datasources</h2> |
---|
89 | </div> |
---|
90 | <div class="main demo"> |
---|
91 | <!-- Begin demo markup --> |
---|
92 | <p>DOM table:</p> |
---|
93 | <table id="demo-dom"> |
---|
94 | <thead> |
---|
95 | <tr> |
---|
96 | <th>ID</th><th>Company</th><th>Name</th> |
---|
97 | </tr> |
---|
98 | </thead> |
---|
99 | <tbody> |
---|
100 | <tr> |
---|
101 | <td>ANATR</td><td>Ana Trujillo Emparedados y helados</td><td>Ana Trujillo</td> |
---|
102 | </tr> |
---|
103 | <tr> |
---|
104 | <td>ANTON</td><td>Antonio Moreno Taqueria</td><td>Antonio Moreno</td> |
---|
105 | </tr> |
---|
106 | <tr> |
---|
107 | <td>AROUT</td><td>Around the Horn</td><td>Thomas Hardy</td> |
---|
108 | </tr> |
---|
109 | <tr> |
---|
110 | <td>BERGS</td><td>Berglunds snabbkop</td><td>Christina Berglund</td> |
---|
111 | </tr> |
---|
112 | </tbody> |
---|
113 | </table> |
---|
114 | |
---|
115 | <p>Array:</p> |
---|
116 | <table id="demo-array"> |
---|
117 | </table> |
---|
118 | |
---|
119 | <p>Hash:</p> |
---|
120 | <table id="demo-hash"> |
---|
121 | </table> |
---|
122 | |
---|
123 | <p>Remote:</p> |
---|
124 | <table id="demo-remote"> |
---|
125 | </table> |
---|
126 | <!-- End demo markup --> |
---|
127 | <div class="demo-options"> |
---|
128 | <!-- Begin options markup --> |
---|
129 | <!-- End options markup --> |
---|
130 | </div> |
---|
131 | <div class="footer demo-description"> |
---|
132 | <p> |
---|
133 | This sample shows how to load data into the grid using various methods such as array, hash and remote. |
---|
134 | </p> |
---|
135 | </div> |
---|
136 | </div> |
---|
137 | </div> |
---|
138 | </body> |
---|
139 | </html> |
---|