| 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 with Dojo.Data via binding</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 | @import "../resources/tundraGrid.css"; |
| 11 | |
| 12 | #grid, #grid2 { |
| 13 | width: 65em; |
| 14 | height: 25em; |
| 15 | padding: 1px; |
| 16 | } |
| 17 | </style> |
| 18 | <script type="text/javascript" src="../../../dojo/dojo.js" |
| 19 | data-dojo-config="isDebug: true, debugAtAllCosts: false, parseOnLoad: true"></script> |
| 20 | <script type="text/javascript"> |
| 21 | dojo.require("dijit.dijit"); |
| 22 | dojo.require("dojox.grid.DataGrid"); |
| 23 | dojo.require("dojo.data.ItemFileReadStore"); |
| 24 | dojo.require("dojox.data.CsvStore"); |
| 25 | dojo.require("dojo.parser"); |
| 26 | </script> |
| 27 | </head> |
| 28 | <body class="tundra"> |
| 29 | <h5>dojox.grid.Grid structure from markup</h5> |
| 30 | <span dojoType="dojox.data.CsvStore" |
| 31 | data-dojo-id="csvStore" url="support/movies.csv"> |
| 32 | </span> |
| 33 | |
| 34 | <table dojoType="dojox.grid.DataGrid" |
| 35 | store="csvStore" |
| 36 | query="{ Title: '*' }" |
| 37 | clientSort="true" |
| 38 | style="width: 800px; height: 300px;"> |
| 39 | <thead> |
| 40 | <tr> |
| 41 | <th width="300px" field="Title">Title of Movie</th> |
| 42 | <th width="5em">Year</th> |
| 43 | </tr> |
| 44 | <tr> |
| 45 | <th colspan="2">Producer</th> |
| 46 | </tr> |
| 47 | </thead> |
| 48 | </table> |
| 49 | |
| 50 | |
| 51 | <span dojoType="dojo.data.ItemFileReadStore" |
| 52 | data-dojo-id="jsonStore" url="../../../dijit/tests/_data/countries.json"> |
| 53 | </span> |
| 54 | <h5>Locked views specified with tables and colgroups</h5> |
| 55 | |
| 56 | <table dojoType="dojox.grid.DataGrid" |
| 57 | store="jsonStore" |
| 58 | rowsPerPage="20" |
| 59 | query="{ name: '*' }" |
| 60 | style="width: 600px; height: 300px;" |
| 61 | rowSelector="20px"> |
| 62 | <colgroup span="1" noscroll="true" width="300px"></colgroup> |
| 63 | <colgroup span="4"></colgroup> |
| 64 | <thead> |
| 65 | <tr> |
| 66 | <th field="name" width="auto">Country/Continent Name</th> |
| 67 | <th width="100px" field="population">Population</th> |
| 68 | <th width="100px" field="area">Land Mass</th> |
| 69 | <th width="100px" field="timezone">Time Zone</th> |
| 70 | <th width="5em" field="type">Type</th> |
| 71 | </tr> |
| 72 | </thead> |
| 73 | </table> |
| 74 | |
| 75 | <h5>A "regular" Grid from markup (no table definition)</h5> |
| 76 | <script type="text/javascript"> |
| 77 | // helper functions and structure definitions for the old markup construction syntax |
| 78 | var layoutCountries = [ |
| 79 | // view 1 |
| 80 | { |
| 81 | cells: [ new dojox.grid.cells.RowIndex() ], |
| 82 | noscroll: true |
| 83 | }, |
| 84 | // view 2 |
| 85 | [ |
| 86 | { field: 'name', width: 'auto' }, |
| 87 | { field: 'type', width: 8 } |
| 88 | ] |
| 89 | ]; |
| 90 | </script> |
| 91 | <div id="grid2" dojoType="dojox.grid.DataGrid" elasticView="2" query="{ name: '*' }" |
| 92 | rowsPerPage="20" store="jsonStore" structure="layoutCountries" rowSelector="20px"> |
| 93 | </div> |
| 94 | |
| 95 | </body> |
| 96 | </html> |