Debian Codegraph @

dojox/data/demos/demo_FileStore_dojoxdata_combo_grid.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <!--
3 Demo application showing LazyLoading File store.
4 -->
5 <html>
6 <head>
7 <title>Demo: dojox.data.FileStore</title>
8 <style type="text/css">
9 @import "../../../dijit/themes/tundra/tundra.css";
10 @import "../../../dojo/resources/dojo.css";
11 @import "../../../dijit/tests/css/dijitTests.css";
12 @import "../../../dojox/grid/resources/tundraGrid.css";
13
14 .fileView {
15 margin: 5px;
16 width: 100%;
17
18 }
19 .fileView .fileViewTitle{
20 color: white;
21 background-color: black;
22 font-size: larger;
23 font-weight: bold;
24
25 }
26
27 .fileView .fileViewTable {
28 border-width: 2px;
29 border-style: solid;
30 width: 100%;
31 }
32
33 .fileView .fileViewTable tr td {
34 border-width: 1px;
35 border-style: solid;
36 border-color: lightgray;
37 width: 50%;
38 vertical-align: top;
39 }
40
41 .fileView .fileName {
42 background-color: lightgray;
43 }
44
45 .tundra .dojoxGrid-cell {
46 text-indent: 3px;
47 }
48 </style>
49
50 <!--
51 The following script tag instantiates the dojo library and sets some basic properties. In this case, the application
52 is told that debug mode is off, and to parse all dojoType widgets when it has fully loaded.
53 -->
54 <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: false, parseOnLoad: true, useCommentedJson: true"></script>
55 <script>
56 dojo.require("dijit.Tree");
57 dojo.require("dijit.tree.ForestStoreModel");
58 dojo.require("dijit.form.ComboBox");
59 dojo.require("dojox.data.FileStore");
60 dojo.require("dojox.grid.DataGrid");
61 dojo.require("dojox.data.demos.widgets.FileView");
62
63 var layoutFiles = [
64 [
65 { field: "name", name: "Filename", width: 20 },
66 { field: "size", name: "File Size (bytes)", width: 10 },
67 { field: "directory", name: "Is Directory", width: 10 },
68 { field: "path", name: "Path", width: 'auto' }
69 ]
70 ];
71
72 </script>
73 </head>
74
75 <body class="tundra">
76 <h1>
77 Demo: Lazy Loading File Browsing Store connected to multiple widgets
78 </h1>
79 <p>All the widgets used in this demo connect to the same filestore instance. It is talking to a filestore rooted in the dojox/data/ sub-directory to make it fast handling when querying across all files.</p>
80 <p><i><b>This demo must be run from a web-server with PHP support enabled. Without PHP support, this demo cannot function. The Demo also requires PHP
81 support for json_encode and json_decode. Please be sure to have those packages installed in your PHP environment.</b></i></p>
82 <hr>
83
84 <div dojoType="dojox.data.FileStore" url="stores/filestore_dojoxdata.php" jsId="fileStore" pathAsQueryParam="true"></div>
85 <div dojoType="dijit.tree.ForestStoreModel" jsId="fileModel"
86 store="fileStore" query="{}"
87 rootId="./dojox/data" rootLabel="./dojox/data" childrenAttrs="children"></div>
88
89
90 <h2>dojox.data.FileStore connected to ComboBox and querying on path:</h2>
91 <div dojoType="dijit.form.ComboBox" store="fileStore" searchAttr="path" value="./demos"></div>
92
93
94 <h2>dojox.data.FileStore connected to Grid and displaying all files:</h2>
95 <div style="width: 100%; height: 300px;">
96 <div id="grid"
97 dojoType="dojox.grid.DataGrid"
98 store="fileStore"
99 structure="layoutFiles"
100 queryOptions="{deep:true}"
101 query="{}"
102 sortFields="[{'attribute':'path', 'descending': false}]"
103 rowsPerPage="40">
104
105 </div>
106 </div>
107
108
109 <h2>dojox.data.FileStore connected to Tree:</h2>
110 <i>Clicking on a file in the tree will display the details about that file.</i>
111 <table style="width: 100%;">
112 <tbody>
113 <tr style="width: 100%;">
114 <td style="width: 50%; vertical-align: top;">
115 <span id="tree" dojoType="dijit.Tree" model="fileModel">
116 <script type="dojo/method" event="onClick" args="item">
117 if (fileStore.isItem(item)){
118 var attachPt = dojo.byId("fileInfo");
119 if (attachPt) {
120 while(attachPt.firstChild) {
121 attachPt.removeChild(attachPt.firstChild);
122 }
123 var newArgs = {};
124 newArgs.name = fileStore.getValue(item, "name");
125 newArgs.path = fileStore.getValue(item, "path");
126 newArgs.size = fileStore.getValue(item, "size");
127 newArgs.directory = fileStore.getValue(item, "directory");
128 newArgs.parentDir = fileStore.getValue(item, "parentDir");
129 var children = fileStore.getValues(item, "children");
130 if (children && children.length > 0) {
131 newArgs.children = [];
132 var i;
133 for (i = 0; i < children.length; i++) {
134 //Note here that even though the store is lazy-loading, the unloaded items for children still
135 //have the 'name' attribute, since it is used as part of the info to load the full item. Generally
136 //you should not access properties of an item that has not been fully inflated yet. It just works
137 //well in this case for this store.
138 newArgs.children.push(fileStore.getValue(children[i], "name"));
139 }
140 }
141 var fInfo = new dojox.data.demos.widgets.FileView(newArgs);
142 attachPt.appendChild(fInfo.domNode);
143 fInfo.startup();
144 }
145 }
146 </script>
147 </span>
148 </td>
149 <td id="fileInfo" STYLE="width: 50%; vertical-align: top;">
150 </td>
151 </tr>
152
153 </tbody>
154 </table>
155 <hr>
156 </body>
157 </html>