| 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>Test dojox.grid.DataGrid Editing with large result set</title> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> |
| 7 | <style type="text/css"> |
| 8 | @import "../resources/Grid.css"; |
| 9 | body { |
| 10 | font-family: Tahoma, Arial, Helvetica, sans-serif; |
| 11 | font-size: 11px; |
| 12 | } |
| 13 | .dojoxGridRowEditing td { |
| 14 | background-color: #F4FFF4; |
| 15 | } |
| 16 | .dojoxGrid input, .dojoxGrid select, .dojoxGrid textarea { |
| 17 | margin: 0; |
| 18 | padding: 0; |
| 19 | border-style: none; |
| 20 | width: 100%; |
| 21 | font-size: 100%; |
| 22 | font-family: inherit; |
| 23 | } |
| 24 | .dojoxGrid input { } |
| 25 | .dojoxGrid select { } |
| 26 | .dojoxGrid textarea { } |
| 27 | #controls { |
| 28 | padding: 6px 0; |
| 29 | } |
| 30 | #grid, #grid2 { |
| 31 | width: 850px; |
| 32 | height: 350px; |
| 33 | border: 1px solid silver; |
| 34 | } |
| 35 | </style> |
| 36 | <script type="text/javascript" src="../../../dojo/dojo.js" |
| 37 | data-dojo-config="isDebug:true, parseOnLoad: true"></script> |
| 38 | <script type="text/javascript"> |
| 39 | dojo.require("dijit.dijit"); |
| 40 | dojo.require("dojox.grid.DataGrid"); |
| 41 | dojo.require("dojo.data.ItemFileWriteStore"); |
| 42 | dojo.require("dojo.parser"); |
| 43 | </script> |
| 44 | <script type="text/javascript" src="support/test_data.js"></script> |
| 45 | <script type="text/javascript"> |
| 46 | var layoutNumbers = [ |
| 47 | // view 1 |
| 48 | { cells: [ new dojox.grid.cells.RowIndex({width: 5}) ], noscroll: true}, |
| 49 | // view 2 |
| 50 | [ |
| 51 | { field: 'id', width: 8 }, |
| 52 | { field: 'label', editable: 'true', width: 'auto' } |
| 53 | ] |
| 54 | ]; |
| 55 | |
| 56 | removeItem = function() { |
| 57 | // Removes the first item in the store |
| 58 | // Grid should reflect removal of the first item and items should be re-indexed |
| 59 | jsonStore.deleteItem(dataStore.data[0].__dojo_data_item); |
| 60 | } |
| 61 | |
| 62 | var i = 0; |
| 63 | addItem = function() { |
| 64 | grid.addRow({name: "country"+(i++), type: "country"}); |
| 65 | } |
| 66 | addItemToStore = function() { |
| 67 | // Adds a new item to the store |
| 68 | // Grid should reflect the new item. |
| 69 | jsonStore.newItem({id: "country"+(i++), label: "country"}); |
| 70 | } |
| 71 | </script> |
| 72 | </head> |
| 73 | <body class="tundra"> |
| 74 | <h2> |
| 75 | dojox.grid.DataGrid Basic Editing test |
| 76 | </h2> |
| 77 | <div id="controls"> |
| 78 | <button onclick="grid.render()">Refresh</button> |
| 79 | <button onclick="grid.edit.focusEditor()">Focus Editor</button> |
| 80 | <button onclick="grid.focus.next()">Next Focus</button> |
| 81 | <button onclick="jsonStore.revert()">Revert (Store)</button> |
| 82 | <button onclick="removeItem()">Remove (Store)</button> |
| 83 | <button onclick="addItemToStore()">Add (Store)</button> |
| 84 | <button onclick="grid.removeSelectedRows()">Remove</button> |
| 85 | <button onclick="grid.edit.apply()">Apply</button> |
| 86 | <button onclick="grid.edit.cancel()">Cancel</button> |
| 87 | <button onclick="grid.singleClickEdit = !grid.singleClickEdit">Toggle singleClickEdit</button> |
| 88 | </div> |
| 89 | <span dojoType="dojo.data.ItemFileWriteStore" |
| 90 | data-dojo-id="jsonStore" url="support/numbers.json"> |
| 91 | </span> |
| 92 | <div id="grid" data-dojo-id="grid" dojoType="dojox.grid.DataGrid" elasticView="2" query="{ id: '*' }" |
| 93 | rowsPerPage="20" store="jsonStore" structure="layoutNumbers" rowSelector="20px"> |
| 94 | </div> |
| 95 | <div id="grid2" data-dojo-id="grid2" dojoType="dojox.grid.DataGrid" elasticView="2" query="{ id: '*' }" |
| 96 | rowsPerPage="20" store="jsonStore" structure="layoutNumbers" rowSelector="20px"> |
| 97 | </div> |
| 98 | </body> |
| 99 | </html> |
| 100 | |
| 101 | |
| 102 |