forked from vitmalina/w2ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid4.html
80 lines (79 loc) · 2.71 KB
/
grid4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="../dist/w2ui.css" />
<script type="text/javascript" src="../libs/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="../src/w2utils.js"></script>
<script type="text/javascript" src="../src/w2tabs.js"></script>
<script type="text/javascript" src="../src/w2toolbar.js"></script>
<script type="text/javascript" src="../src/w2fields.js"></script>
<script type="text/javascript" src="../src/w2popup.js"></script>
<script type="text/javascript" src="../src/w2grid.js"></script>
<script>
//<![CDATA[
$(function () {
$('#grid').w2grid({
name : 'grid1',
show : {
toolbar : true,
footer : true,
lineNumbers : true,
toolbarDelete: true,
selectColumn : false
},
selectType: 'cell',
columns: []
});
// generate columns
var letters = 'abcdefghijklmnopqrstuvwxyz';
var dletters = letters.split('');
for (var i = 0; i < letters.length; i++) {
var j = 0;
// for (var j = 0; j < letters.length; j++) {
dletters.push(letters[j] + letters[i]);
// }
}
var useGroups = true;
if (useGroups) {
w2ui.grid1.columnGroups.push({ span: 2, caption: 'a - b' }); // frozen
w2ui.grid1.columnGroups.push({ span: 2, caption: 'c - d' });
}
for (var i = 0; i < dletters.length; i++) {
w2ui.grid1.columns.push({
field: dletters[i],
caption: '<div style="text-align: center">'+ dletters[i].toUpperCase() + '</div>',
size: (100 + 0) + 'px',
editable: { type: 'div' }
});
if (useGroups && i >= 4 && (i % 4) == 0) {
var end = Math.min(i+3, dletters.length - 1);
w2ui.grid1.columnGroups.push({
span: end - i + 1,
caption: dletters[i]+" - "+dletters[end]
});
}
}
// add 10k records
for (var i = 0; i < 310; i++) {
var rec = { recid: i + 10 };
for (var j = 0; j < dletters.length; j++) {
rec[dletters[j]] = dletters[j] + (i + 1);
}
w2ui['grid1'].records.push(rec);
}
w2ui.grid1.columns[0].hidden = true;
w2ui.grid1.columns[3].hidden = true;
w2ui.grid1.columns[0].frozen = true;
w2ui.grid1.columns[1].frozen = true;
w2ui.grid1.records[1].summary = true;
w2ui.grid1.records[2].summary = true;
// w2ui.grid1.records[5].w2ui = { colspan: { f: 2 } };
// w2ui.grid1.records[3].style = { 4: 'background-color: red !important' };
w2ui.grid1.refresh();
});
//]]>
</script>
</head>
<body>
<div id="grid" style="width: 1024px; height: 568px;"></div>
</body>
</html>