Debian Codegraph @

dojox/grid/tests/test_treegrid_model_lazy.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <head>
4 <title>dojox.grid.TreeGrid Model-based lazy loading test</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
6 <style type="text/css">
7 @import "../../../dojo/resources/dojo.css";
8 @import "../../../dijit/themes/tundra/tundra.css";
9 @import "../resources/Grid.css";
10 @import "../resources/tundraGrid.css";
11 .grid {
12 width: 70em;
13 height: 40em;
14 }
15 </style>
16 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: false"></script>
17 <script type="text/javascript">
18 dojo.require("dojox.grid.TreeGrid");
19 dojo.require("dijit.tree.ForestStoreModel");
20 dojo.require("dojox.data.JsonRestStore");
21 dojo.require("dijit.form.Button");
22 dojo.require("dojo.parser");
23
24
25 jsonStore = null, childItems = null, dataItems = null, fullItems = null;
26 dojo.addOnLoad(function(){
27 childItems = {
28 'AF': [
29 { id: 'EG', name:'Egypt', type:'country' },
30 { id: 'KE', name:'Kenya', type:'country' },
31 { id: 'SD', name:'Sudan', type:'country' }
32 ],
33 'KE': [
34 { id: 'Nairobi', name:'Nairobi', type:'city' },
35 { id: 'Mombasa', name:'Mombasa', type:'city' }
36 ],
37 'SD': [
38 { id: 'Khartoum', name:'Khartoum', type:'city' }
39 ],
40 'AS': [
41 { id: 'CN', name:'China', type:'country' },
42 { id: 'IN', name:'India', type:'country' },
43 { id: 'RU', name:'Russia', type:'country' },
44 { id: 'MN', name:'Mongolia', type:'country' }
45 ],
46 'OC': [
47 { id: 'AU', name:'Australia', type:'country', population:'21 million'}
48 ],
49 'EU': [
50 { id: 'DE', name:'Germany', type:'country' },
51 { id: 'FR', name:'France', type:'country' },
52 { id: 'ES', name:'Spain', type:'country' },
53 { id: 'IT', name:'Italy', type:'country' }
54 ]
55 };
56 dataItems = [
57 { id: 'AF', name:'Africa', type:'continent', population:'900 million', area: '30,221,532 sq km',
58 timezone: '-1 UTC to +4 UTC', children: true, '$ref': 'AF' },
59 { id: 'AS', name:'Asia', type:'continent', children: true, '$ref': 'AS' },
60 { id: 'OC', name:'Oceania', type:'continent', population:'21 million', children: true, '$ref': 'OC' },
61 { id: 'EU', name:'Europe', type:'continent', children: true, '$ref': 'EU' }
62 ];
63 fullItems = {};
64 dojo.forEach(dataItems, function(item){
65 var full = fullItems[item.id] = dojo.mixin({}, item, { children: childItems[item.id] });
66 delete full['$ref'];
67 });
68 var mockService = function(query){
69 var d = new dojo.Deferred();
70 if(typeof query == 'string'){
71 setTimeout(function(){
72 d.callback(fullItems[query]);
73 }, 500);
74 }else{
75 d.fullLength = dataItems.length;
76 d.callback(dataItems);
77 }
78 return d;
79 };
80 jsonStore = new dojox.data.JsonRestStore({
81 service: mockService,
82 target: '/some/url'
83 });
84 dojo.parser.parse();
85 });
86 </script>
87 </head>
88 <body class="tundra">
89 <h1 class="testTitle">Test: dojox.grid.TreeGrid - Model-based lazy loading</h1>
90
91 <div dojoType="dijit.tree.ForestStoreModel" data-dojo-id="continentModel"
92 store="jsonStore" query="{type:'continent'}"
93 deferItemLoadingUntilExpand="true"
94 rootId="continentRoot" rootLabel="Continents" childrenAttrs="children">
95 </div>
96
97 <h4 class="testSubtitle">dojox.grid.TreeGrid n-Level</h4>
98 <table data-dojo-id="grid" dojoType="dojox.grid.TreeGrid" class="grid" treeModel="continentModel">
99 <thead>
100 <tr>
101 <th field="name" width="auto">Name</th>
102 </tr>
103 </thead>
104 </table>
105 </body>
106 </html>
107