Frozen Rows and Columns
You can freeze rows and columns by setting the grid's frozenRows and frozenColumns properties.
Frozen cells do not scroll but are selectable/editable like regular cells:
Id
Country
Downloads
Sales
Expenses
Num1
Num2
Num3
Num4
Num5
Num6
Num7
Num8
Num9
Num10
0
US
1,893
4,406.73
1,715.14
4,090.23
580.61
1.91
4,575.83
332.37
3,017.68
2,486.49
2,285.14
2,329.39
3,432.49
1
Germany
16,324
7,324.23
1,164.75
4,257.37
2,365.32
2,984.24
2,186.29
626.88
4,754.85
3,280.94
3,944.80
248.65
751.67
2
UK
14,926
2,852.02
3,427.93
1,081.73
3,236.09
1,813.42
2,872.98
1,484.22
3,802.09
31.54
69.65
3,977.42
2,084.97
3
Japan
9,840
5,497.03
1,394.10
4,187.38
4,637.75
100.83
2,079.64
2,519.79
4,545.65
3,177.10
4,883.36
1,571.32
420.89
4
Italy
19,571
8,223.68
4,577.95
2,532.75
1,530.82
124.17
831.99
3,774.84
821.18
1,614.12
1,973.57
1,681.67
648.34
5
Greece
1,787
4,856.53
2,488.49
2,123.52
1,984.52
308.49
541.17
1,336.84
2,686.16
4,731.10
4,864.38
579.20
2,635.31
6
US
5,278
1,387.30
804.33
361.54
2,383.84
3,729.74
885.92
1,477.98
1,497.49
2,241.74
1,774.44
1,884.05
1,252.85
7
Germany
10,211
5,295.55
3,791.07
683.70
3,941.13
714.05
3,154.14
903.06
168.09
4,333.73
1,052.01
2,144.51
2,312.96
8
UK
14,531
3,009.92
3,184.57
3,990.57
1,346.39
4,025.75
967.27
3,557.58
1,190.94
4,506.10
984.01
4,223.73
1,006.90
9
Japan
9,758
9,921.63
2,041.69
2,269.92
1,465.94
2,953.21
1,246.52
2,346.35
1,929.67
1,760.80
4,866.36
352.82
549.85
10
Italy
2,836
371.55
1,239.90
701.23
955.65
2,435.22
3,221.60
2,783.04
4,446.23
1,504.17
280.34
1,649.33
1,648.24
11
Greece
13,173
9,547.62
4,024.67
1,167.00
3,544.36
3,769.27
1,314.59
3,493.20
1,835.27
1,429.37
3,037.37
4,496.24
3,919.72
12
US
2,713
5,607.40
76.28
1,596.38
3,164.24
483.04
413.24
1,253.04
4,092.38
2,407.96
4,967.45
2,969.27
930.45
Id
Country
Downloads
Sales
Expenses
Num1
Num2
Num3
Num4
Num5
Num6
Num7
Num8
Num9
Num10
0
- C1FlexGrid/ColumnsFreezing.js
- C1FlexGrid/ColumnsFreezing.css
- ColumnsFreezingController.cs
- ColumnsFreezing.cshtml
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 | // This file locates: "Scripts/Lesson/C1FlexGrid/ColumnsFreezing.js". c1.documentReady(function () { // generate some random data var countries = 'US,Germany,UK,Japan,Italy,Greece' .split( ',' ), data = []; for (var i = 0; i < 200; i++) { data.push({ id: i, country: countries[i % countries.length], downloads: Math.round(Math.random() * 20000), sales: Math.random() * 10000, expenses: Math.random() * 5000, num1: Math.random() * 5000, num2: Math.random() * 5000, num3: Math.random() * 5000, num4: Math.random() * 5000, num5: Math.random() * 5000, num6: Math.random() * 5000, num7: Math.random() * 5000, num8: Math.random() * 5000, num9: Math.random() * 5000, num10: Math.random() * 5000, }); } var theGrid = wijmo.Control.getControl( '#theGrid' ); theGrid.itemsSource = data; theGrid.frozenRows = 2; theGrid.frozenColumns = 1; // toggle frozen rows document.getElementById( 'btnFreezeRows' ).addEventListener( 'click' , function () { theGrid.frozenRows = theGrid.frozenRows > 0 ? 0 : 2; }); document.getElementById( 'btnFreezeCols' ).addEventListener( 'click' , function () { theGrid.frozenColumns = theGrid.frozenColumns > 0 ? 0 : 1; }); }); |
1 2 3 4 5 6 | // This file locates: "Content/css/Lesson/C1FlexGrid/ColumnsFreezing.css". /* style frozen cells */ .wj-cell.wj-frozen:not(.wj-header):not(.wj-group):not(.wj-state-selected):not(.wj-state-multi-selected), .wj-cell.wj-frozen.wj-alt:not(.wj-header):not(.wj-group):not(.wj-state-selected):not(.wj-state-multi-selected) { background: #fffff5 } |
1 2 3 4 5 6 7 8 9 10 11 12 13 | using System.Web.Mvc; namespace LearnMvcClient.Controllers { public partial class C1FlexGridController : Controller { // GET: ColumnsFreezing public ActionResult ColumnsFreezing() { return View(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | < h1 > @Html .Raw(Resources.C1FlexGrid.ColumnsFreezing_Title) </ h1 > < p > @Html .Raw(Resources.C1FlexGrid.ColumnsFreezing_Text1) </ p > < p > @Html .Raw(Resources.C1FlexGrid.ColumnsFreezing_Text2) </ p > @Html .C1().FlexGrid().Id( "theGrid" ).Height(250) < button id = "btnFreezeRows" class = "btn btn-default" > @Html .Raw(Resources.C1FlexGrid.ColumnsFreezing_Text3) </ button > < button id = "btnFreezeCols" class = "btn btn-default" > @Html .Raw(Resources.C1FlexGrid.ColumnsFreezing_Text4) </ button > |