Debian Codegraph @

dojox/grid/tests/test_edit_keyNav.html

raw symbols SCIP
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5 <title>Test dojox.grid.DataGrid Editing</title>
6 <style>
7 @import "../resources/Grid.css";
8 body {
9 font-family: Tahoma, Arial, Helvetica, sans-serif;
10 font-size: 11px;
11 }
12 .dojoxGridRowEditing td {
13 background-color: #F4FFF4;
14 }
15 .dojoxGrid input, .dojoxGrid select, .dojoxGrid textarea {
16 margin: 0;
17 padding: 0;
18 border-style: none;
19 width: 100%;
20 font-size: 100%;
21 font-family: inherit;
22 }
23 .dojoxGrid input {
24 }
25 .dojoxGrid select {
26 }
27 .dojoxGrid textarea {
28 }
29 #controls {
30 padding: 6px 0;
31 }
32 #grid {
33 width: 850px;
34 height: 350px;
35 border: 1px solid silver;
36 }
37 </style>
38 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:false, parseOnLoad: true"></script>
39 <script type="text/javascript">
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 // ==========================================================================
47 // Custom formatter
48 // ==========================================================================
49 formatMoney = function(inDatum) {
50 return isNaN(inDatum) ? '...' : '$' + parseFloat(inDatum).toFixed(2);
51 }
52 // ==========================================================================
53 // Grid structure
54 // ==========================================================================
55 statusCell = { field: 'col3', name: 'Status', styles: 'text-align: center;', type: dojox.grid.cells.Select, options: [ "new", "read", "replied" ] };
56 gridLayout = [{
57 defaultCell: { width: 8, editable: true, styles: 'text-align: right;' },
58 cells: [
59 { name: 'Id', field: 'id', width: 3, editable: false },
60 { name: 'Priority', field: 'col1', styles: 'text-align: center;', type: dojox.grid.cells.Select, options: ["normal", "note", "important"] },
61 { name: 'Mark', width: 3, field: 'col2', styles: 'text-align: center;', type: dojox.grid.cells.Bool },
62 statusCell,
63 { name: 'Message', field: 'col4', styles: '', width: '100%' },
64 { name: 'Amount1', field: 'col5', formatter: formatMoney },
65 { name: 'Amount2', field: 'col6', editable: false, formatter: formatMoney }
66 ]
67 },{
68 defaultCell: { width: 4, editable: true, styles: 'text-align: right;' },
69 rows: [
70 { name: 'Mark', width: 3, field: 'col2', styles: 'text-align: center;', type: dojox.grid.cells.Bool},
71 statusCell,
72 { name: 'Amount3', field: 'col5', editable: false, formatter: formatMoney},
73 { name: 'Detail', value: 'Detail', editable: false}
74 ]
75 }];
76 // ==========================================================================
77 // UI Action
78 // ==========================================================================
79 addRow = function(){
80 test_store.newItem({
81 id: grid.rowCount,
82 col1: 'normal',
83 col2: false,
84 col3: 'new',
85 col4: 'Now is the time for all good men to come to the aid of their party.',
86 col5: 99.99,
87 col6: 9.99,
88 col7: false
89 });
90 }
91 </script>
92 </head>
93 <body>
94 <h2>
95 dojox.grid.DataGrid Basic Editing and Key Navigation test
96 </h2>
97 <div id="controls">
98 <button onclick="grid.render()">Refresh</button>&nbsp;&nbsp;&nbsp;
99 <button onclick="grid.edit.focusEditor()">Focus Editor</button>
100 <button onclick="grid.focus.next()">Next Focus</button>&nbsp;&nbsp;&nbsp;
101 <button onclick="addRow()">Add Row</button>
102 <button onclick="grid.removeSelectedRows()">Remove</button>&nbsp;&nbsp;&nbsp;
103 <button onclick="grid.edit.apply()">Apply</button>
104 <button onclick="grid.edit.cancel()">Cancel</button>&nbsp;&nbsp;&nbsp;
105 <button onclick="grid.singleClickEdit = !grid.singleClickEdit">Toggle singleClickEdit</button>&nbsp;
106 </div>
107 <p>Id, Priority, Mark, Status, Message, Amount1, second Mark, second Status fields are editable, Amount2,
108 Amount3, and detail field are not editable. Once in edit mode you can tab and shift-tab between
109 editable fields and remain in edit mode. Pressing escape leaves edit mode and arrow keys will again move
110 between cells. </p>
111 <div id="grid" dojoType="dojox.grid.DataGrid"
112 data-dojo-id="grid"
113 rowSelector="20px"
114 store="test_store" structure="gridLayout"></div>
115 <br />
116 <div id="rowCount"></div>
117 </body>
118 </html>