Debian Codegraph @

dojox/grid/tests/test_data_grid_empty.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.DataGrid with an empty result set</title>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
7 <style type="text/css">
8 @import "../../../dojo/resources/dojo.css";
9 @import "../resources/Grid.css";
10 #grid {
11 width: 65em;
12 height: 25em;
13 }
14 </style>
15 <script type="text/javascript" src="../../../dojo/dojo.js"
16 data-dojo-config="isDebug: true, debugAtAllCosts: false, parseOnLoad: true"></script>
17 <script type="text/javascript">
18 dojo.require("dijit.dijit");
19 dojo.require("dojox.grid.DataGrid");
20 dojo.require("dojo.data.ItemFileWriteStore");
21 dojo.require("dojo.parser");
22 dojo.require("dijit.form.Button");
23 </script>
24 <script type="text/javascript">
25 var layoutCountries = [
26 // view 1
27 { cells: [ new dojox.grid.cells.RowIndex({width: 5}) ], noscroll: true},
28 // view 2
29 [
30 { name: "field 0", field: 'name', width: 8 },
31 { name: "field 1", field: 'type', width: 8 }
32 ]
33 ];
34
35 var emptyData = { identifier: 'name', label: 'name', items: []};
36 var jsonStore = new dojo.data.ItemFileWriteStore({data: emptyData});
37 var numItems = 0;
38 </script>
39 </head>
40 <body class="tundra">
41 <h5>dojox.grid.DataGrid using initially-empty write stores and then adding an item. Item should show up correctly (no "..."s) when added.</h5>
42 <br>
43 <div id="grid" dojoType="dojox.grid.DataGrid" elasticView="2" query="{ name: '*' }" rowsPerPage="20"
44 store="jsonStore" structure="layoutCountries" rowSelector="20px">
45 </div>
46 <button dojoType="dijit.form.Button">
47 <script type="dojo/method" data-dojo-event="onClick">
48 numItems++;
49 dojo.connect(jsonStore, "fetch", function(){
50 console.error("Calling newItem should not trigger a fetch.");
51 throw new Error("Calling newItem should not trigger a fetch.");
52 });
53 jsonStore.newItem({
54 name: numItems + "-person Land",
55 type: "city",
56 population: numItems
57 });
58 </script>
59 Add Item
60 </button>
61 </body>
62 </html>