Files
openlayers/master/examples/test_enhanced_grid_indirectSelection.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

106 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test IndirectSelection plugin of dojox.grid.EnhancedGrid</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<link rel=stylesheet href="support/common.css"/>
<style type="text/css">
body {
font-size: 0.9em;
font-family: Geneva, Arial, Helvetica, sans-serif;
padding: 0.5em;
}
.title {
text-align:center;
}
#grid1, #grid2 {
width: 85.2em;
height: 50em;
}
</style>
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug:true, parseOnLoad: true"></script>
<script type="text/javascript" src="../../../../dijit/tests/_testCommon.js"></script>
<script type="text/javascript">
dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojox.grid.enhanced.plugins.IndirectSelection");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojo.parser");
</script>
<script type="text/javascript">
var data = {
identifier: 'id',
label: 'id',
items: []
};
var data_list = [
{ col1: "normal", col2: false, col3: "new", col4: 'But are not followed by two hexadecimal', col5: 29.91, col6: 10, col7: false },
{ col1: "important", col2: false, col3: "new", col4: 'Because a % sign always indicates', col5: 9.33, col6: -5, col7: false },
{ col1: "important", col2: false, col3: "read", col4: 'Signs can be selectively', col5: 19.34, col6: 0, col7: true },
{ col1: "note", col2: false, col3: "read", col4: 'However the reserved characters', col5: 15.63, col6: 0, col7: true },
{ col1: "normal", col2: false, col3: "replied", col4: 'It is therefore necessary', col5: 24.22, col6: 5.50, col7: true },
{ col1: "important", col2: false, col3: "replied", col4: 'To problems of corruption by', col5: 9.12, col6: -3, col7: true },
{ col1: "note", col2: false, col3: "replied", col4: 'Which would simply be awkward in', col5: 12.15, col6: -4, col7: false }
];
var rows = 300;
for(var i=0, l=data_list.length; i<rows; i++){
data.items.push(dojo.mixin({ id: i }, data_list[i%l]));
}
// global var "test_store"
test_store = new dojo.data.ItemFileWriteStore({data: data});
var layout = [[
{name: 'Column 1', field: 'id'},
{name: 'Column 2', field: 'col2'},
{name: 'Column 3', field: 'col3'},
{name: 'Column 4', field: 'col4', width: "150px"},
{name: 'Column 5', field: 'col5'},
{name: 'Column 6', field: 'col6'},
{name: 'Column 7', field: 'col7'},
{name: 'Column 8', field: 'col5'}
]];
dojo.addOnLoad(function(){
grid = new dojox.grid.EnhancedGrid({
id: "grid1",
store: test_store,
structure: layout,
rowSelector: "20px",
plugins: {indirectSelection: {headerSelector:true, name: "Selection", width: "60px", styles: "text-align: center;"}}
});
dojo.byId("gridDiv").appendChild(grid.domNode);
grid.startup();
});
var disabled = false;
function toggleDisabled(id){
disabled = !disabled;
for(var i = 0; i < rows; i++){
dijit.byId(id).rowSelectCell.setDisabled(i, disabled);
}
}
</script>
</head>
<body class="claro">
<h1 class="title">dojox.grid.EnhancedGrid - IndirectSelection</h1>
<p>
<b>Multiple selection mode:</b>
<div id="gridDiv"></div><br/>
<input type='button' value='Select All' onclick='dijit.byId("grid1").rowSelectCell.toggleAllSelection(true)'/>&nbsp;&nbsp;
<input type='button' value='Deselect All' onclick='dijit.byId("grid1").rowSelectCell.toggleAllSelection(false)'/>&nbsp;&nbsp;
<input type='button' value='Toggle Disabled All' onclick='toggleDisabled("grid1")'/><br/><br/> </p>
<p>
<b>
Single selection mode:
</b>
<div id="grid2" dojoType="dojox.grid.EnhancedGrid" rowsPerPage="30" selectionMode="single"
plugins='{indirectSelection: {name: "Selection", width:"60px", styles:"text-align: left;"}}'
store="test_store" structure="layout" rowSelector="20px">
</div>
</p>
</body>
</html>