1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <title>Test dojox.Grid Editing</title>
7 @import "../_grid/tundraGrid.css";
8 @import "../../../dojo/resources/dojo.css";
9 @import "../../../dijit/themes/tundra/tundra.css";
10 @import "../../../dijit/tests/css/dijitTests.css";
13 width: 100%; /* make the body expand to fill the visible window */
\r
15 overflow: hidden; /* erase window level scrollbars */
\r
20 <script type="text/javascript" src="../../../dojo/dojo.js"
21 djConfig="isDebug:false, parseOnLoad: true"></script>
23 <script type="text/javascript">
24 dojo.require("dojox.grid.Grid");
25 dojo.require("dijit.layout.BorderContainer");
26 dojo.require("dijit.layout.ContentPane");
27 dojo.require("dojo.parser");
30 <script type="text/javascript">
31 // ==========================================================================
32 // Create a data model
33 // ==========================================================================
35 [ "normal", false, "new", 'But are not followed by two hexadecimal', 29.91, 10, false ],
36 [ "important", false, "new", 'Because a % sign always indicates', 9.33, -5, false ],
37 [ "important", false, "read", 'Signs can be selectively', 19.34, 0, true ],
38 [ "note", false, "read", 'However the reserved characters', 15.63, 0, true ],
39 [ "normal", false, "replied", 'It is therefore necessary', 24.22, 5.50, true ],
40 [ "important", false, "replied", 'To problems of corruption by', 9.12, -3, true ],
41 [ "note", false, "replied", 'Which would simply be awkward in', 12.15, -4, false ]
44 for(var i=0, l=data.length; i<rows-l; i++){
45 data.push(data[i%l].slice(0));
47 model = new dojox.grid.data.Table(null, data);
49 // ==========================================================================
51 // ==========================================================================
54 type: 'dojox.GridRowView', width: '20px'
57 defaultCell: { width: 8, editor: dojox.grid.editors.Input, styles: 'text-align: right;' },
60 { name: 'Id', width: 3, get: function(inRowIndex){ return inRowIndex+1;} },
61 { name: 'Priority', styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: ["normal", "note", "important"]},
62 { name: 'Mark', width: 3, styles: 'text-align: center;', editor: dojox.grid.editors.Bool },
63 { name: 'Status', field: 2, styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: [ "new", "read", "replied" ]},
64 { name: 'Message', styles: '', width: '100%' },
73 <div dojoType="dijit.layout.BorderContainer" liveSplitters="false" persist="true"
74 id="verticalSplitParam" design="headline" style="width: 100%; height: 100%;">
76 <div dojoType="dijit.layout.ContentPane" id="mybuttons" region="top"
77 splitter="true" style="width: 100%; height: 10%;">
80 <button onclick="grid.refresh()">Refresh</button>
81 <button onclick="grid.edit.focusEditor()">Focus Editor</button>
82 <button onclick="grid.focus.next()">Next Focus</button>
83 <button onclick="addRow()">Add Row</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>
91 <div dojoType="dijit.layout.ContentPane" id="gridContainer1" region="center" splitter="true" style="background: red;" >
92 <div jsId="grid" class="myGrid" dojoType="dojox.Grid" model="model" structure="gridLayout"></div>