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
13,947
6,036.92
1,831.52
4,862.06
4,424.10
3,390.58
81.53
683.68
1,450.37
1,593.42
3,143.55
1,369.20
385.37
1
Germany
8,895
3,138.09
1,509.81
4,879.38
4,138.18
252.45
1,982.04
1,193.21
105.98
231.32
2,977.73
3,566.53
1,244.84
2
UK
11,802
4,189.95
354.07
691.48
1,938.66
342.69
3,701.57
3,884.99
1,690.50
2,221.33
46.80
3,315.83
4,585.97
3
Japan
5,881
6,984.23
1,183.24
2,156.98
3,711.81
4,928.44
2,446.79
832.31
4,050.00
4,568.56
42.68
681.03
4,262.76
4
Italy
17,722
2,365.78
2,673.24
1,956.84
4,508.09
2,683.47
1,597.17
3,141.09
2,760.31
1,311.47
35.91
1,565.64
3,921.96
5
Greece
9,526
6,350.37
4,328.41
2,247.60
1,764.70
3,025.23
46.23
2,893.10
4,432.64
2,552.24
2,273.59
690.18
3,991.41
6
US
3,616
6,867.26
4,056.45
4,217.44
4,009.05
4,114.14
1,459.12
1,644.05
587.49
4,835.13
4,647.81
2,964.62
1,274.24
7
Germany
6,027
899.93
1,824.45
4,558.22
792.36
2,382.62
4,486.76
2,419.17
166.48
2,500.42
2,410.09
3,048.04
3,415.58
8
UK
18,275
8,370.30
2,610.76
127.14
3,411.64
2,709.64
3,323.62
901.42
2,332.55
280.71
1,001.51
3,840.39
2,041.22
9
Japan
15,245
1,682.85
2,674.22
266.57
1,162.40
1,750.76
1,695.04
379.39
3,152.03
4,199.89
3,088.34
1,212.85
2,132.20
10
Italy
13,216
6,512.61
559.21
1,873.17
3,387.36
2,865.26
3,232.39
3,624.27
579.74
803.74
37.74
3,179.71
1,866.83
11
Greece
4,793
2,525.56
803.03
1,177.02
1,944.49
897.95
455.48
1,179.34
517.56
1,285.12
769.46
859.39
984.08
12
US
10,914
1,248.73
477.88
2,400.36
233.80
287.63
888.62
1,273.01
845.78
3,334.63
532.74
2,991.44
4,543.19
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>