| 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 trapping of data store errors.</title> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> |
| 7 | <style type="text/css"> |
| 8 | @import "../../../dijit/themes/tundra/tundra.css"; |
| 9 | @import "../../../dojo/resources/dojo.css"; |
| 10 | @import "../../../dijit/tests/css/dijitTests.css"; |
| 11 | @import "../resources/Grid.css"; |
| 12 | @import "../resources/tundraGrid.css"; |
| 13 | |
| 14 | #grid{ |
| 15 | width: 65em; |
| 16 | height: 25em; |
| 17 | padding: 1px; |
| 18 | } |
| 19 | </style> |
| 20 | <script type="text/javascript" src="../../../dojo/dojo.js" |
| 21 | data-dojo-config="isDebug: true, debugAtAllCosts: false, parseOnLoad: true"></script> |
| 22 | <script type="text/javascript"> |
| 23 | dojo.require("dijit.dijit"); |
| 24 | dojo.require("dojox.grid.DataGrid"); |
| 25 | dojo.require("dojox.data.CsvStore"); |
| 26 | dojo.require("dojo.parser"); |
| 27 | </script> |
| 28 | |
| 29 | <script type="text/javascript"> |
| 30 | var layoutMovies =[ |
| 31 | { name: "Title", field: "Title", width: 'auto' }, |
| 32 | { name: "Year", field: "Year", width: 5 }, |
| 33 | { name: "Producer", field: "Producer", width: 20 } |
| 34 | ]; |
| 35 | </script> |
| 36 | </head> |
| 37 | <body class="tundra"> |
| 38 | <h1>dojox.grid.DataGrid with trapping of data store errors</h1> |
| 39 | |
| 40 | <h2>dojox.data.CsvStore:</h2>. |
| 41 | <i>This grid does not load data. The data store references a non-existent URL on purpose. It should trigger a failure that we catch and display in an alert</i> |
| 42 | <span dojoType="dojox.data.CsvStore" |
| 43 | data-dojo-id="csvStore" url="support/NoSuchMovieFile.csv"> |
| 44 | </span> |
| 45 | <div id="grid" data-dojo-id="grid" dojoType="dojox.grid.DataGrid" elasticView="2" query="{ Title: '*' }" |
| 46 | rowsPerPage="5" store="csvStore" structure="layoutMovies" autoRender="false"> |
| 47 | <script type="dojo/connect" data-dojo-event="onFetchError" data-dojo-args="error"> |
| 48 | alert("Error was encountered when store was queried: " + dojo.toJson(error, true)); |
| 49 | </script> |
| 50 | </div> |
| 51 | </body> |
| 52 | </html> |
| 53 | |
| 54 |