aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/grid/tests/test_tundra_edit.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/grid/tests/test_tundra_edit.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/grid/tests/test_tundra_edit.html')
-rw-r--r--includes/js/dojox/grid/tests/test_tundra_edit.html139
1 files changed, 139 insertions, 0 deletions
diff --git a/includes/js/dojox/grid/tests/test_tundra_edit.html b/includes/js/dojox/grid/tests/test_tundra_edit.html
new file mode 100644
index 0000000..0aa2eeb
--- /dev/null
+++ b/includes/js/dojox/grid/tests/test_tundra_edit.html
@@ -0,0 +1,139 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Test dojox.Grid Editing</title>
+ <style>
+ @import "../_grid/tundraGrid.css";
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../../dijit/themes/tundra/tundra.css";
+ @import "../../../dijit/tests/css/dijitTests.css";
+
+ .dojoxGrid-row-editing td {
+ background-color: #F4FFF4;
+ }
+ .dojoxGrid input, .dojoxGrid select, .dojoxGrid textarea {
+ margin: 0;
+ padding: 0;
+ border-style: none;
+ width: 100%;
+ font-size: 100%;
+ font-family: inherit;
+ }
+ .dojoxGrid input {
+ }
+ .dojoxGrid select {
+ }
+ .dojoxGrid textarea {
+ }
+
+ #controls {
+ padding: 6px 0;
+ }
+ #controls button {
+ margin-left: 10px;
+ }
+ .myGrid {
+ width: 850px;
+ height: 350px;
+ border: 1px solid silver;
+ }
+ </style>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug:false, parseOnLoad: true"></script>
+ <script type="text/javascript">
+ dojo.require("dojox.grid.Grid");
+ dojo.require("dojo.parser");
+ </script>
+ <script type="text/javascript">
+ // ==========================================================================
+ // Create a data model
+ // ==========================================================================
+ data = [
+ [ "normal", false, "new", 'But are not followed by two hexadecimal', 29.91, 10, false ],
+ [ "important", false, "new", 'Because a % sign always indicates', 9.33, -5, false ],
+ [ "important", false, "read", 'Signs can be selectively', 19.34, 0, true ],
+ [ "note", false, "read", 'However the reserved characters', 15.63, 0, true ],
+ [ "normal", false, "replied", 'It is therefore necessary', 24.22, 5.50, true ],
+ [ "important", false, "replied", 'To problems of corruption by', 9.12, -3, true ],
+ [ "note", false, "replied", 'Which would simply be awkward in', 12.15, -4, false ]
+ ];
+ var rows = 10000;
+ for(var i=0, l=data.length; i<rows-l; i++){
+ data.push(data[i%l].slice(0));
+ }
+ model = new dojox.grid.data.Table(null, data);
+
+ // ==========================================================================
+ // Tie some UI to the data model
+ // ==========================================================================
+ model.observer(this);
+ modelChange = function(){
+ dojo.byId("rowCount").innerHTML = 'Row count: ' + model.count;
+ }
+
+ // ==========================================================================
+ // Custom formatter
+ // ==========================================================================
+ formatMoney = function(inDatum){
+ return isNaN(inDatum) ? '...' : '$' + parseFloat(inDatum).toFixed(2);
+ }
+
+ // ==========================================================================
+ // Grid structure
+ // ==========================================================================
+ statusCell = {
+ field: 2,
+ name: 'Status',
+ styles: 'text-align: center;',
+ editor: dojox.grid.editors.Select,
+ options: [ "new", "read", "replied" ]
+ };
+
+ gridLayout = [
+ {
+ type: 'dojox.GridRowView', width: '20px'
+ },
+ {
+ defaultCell: { width: 8, editor: dojox.grid.editors.Input, styles: 'text-align: right;' },
+ rows: [
+ [
+ { name: 'Id', width: 3, get: function(inRowIndex){ return inRowIndex+1;} },
+ { name: 'Priority', styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: ["normal", "note", "important"]},
+ { name: 'Mark', width: 3, styles: 'text-align: center;', editor: dojox.grid.editors.Bool },
+ statusCell,
+ { name: 'Message', styles: '', width: '100%' },
+ { name: 'Amount', formatter: formatMoney }
+ ]
+ ]
+ }
+ ];
+ // ==========================================================================
+ // UI Action
+ // ==========================================================================
+ addRow = function() {
+ grid.addRow([ "normal", false, "new", 'Now is the time for all good men to come to the aid of their party.', 99.99, 9.99, false ]);
+ }
+ </script>
+ </head>
+ <body class="tundra">
+ <h1>dojox.Grid Basic Editing test</h1>
+ <br />
+ <div id="controls">
+ <button onclick="grid.refresh()">Refresh</button>
+ <button onclick="grid.edit.focusEditor()">Focus Editor</button>
+ <button onclick="grid.focus.next()">Next Focus</button>
+ <button onclick="addRow()">Add Row</button>
+ <button onclick="grid.removeSelectedRows()">Remove</button>
+ <button onclick="grid.edit.apply()">Apply</button>
+ <button onclick="grid.edit.cancel()">Cancel</button>
+ <button onclick="grid.singleClickEdit = !grid.singleClickEdit">Toggle singleClickEdit</button>
+ </div>
+ <br />
+ <div jsId="grid" class="myGrid"
+ dojoType="dojox.Grid" model="model"
+ structure="gridLayout"></div>
+ <br />
+ <div id="rowCount"></div>
+ </body>
+</html>