Demo - Frozen Rows and Columns
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.pdf.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.pdf.min.js"></script>
<br/>
<br/>
<br/>
<div class="container">
<div id="theGrid"></div>
<button id="export" class="btn btn-default">
Export to PDF
</button>
</div>
CSS
.wj-flexgrid {
max-height: 250px;
margin: 10px 0;
}
body {
margin-bottom: 20px;
}
/* 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: rgb(255,255,125);
}
.wj-flexgrid .wj-cell.wj-frozen-col {
border-right: 2px solid red;
z-index: 0;
}
JavaScript
onload = function () {
// generate some random data
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
data = [];
for (var i = 0; i < 10; 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,
});
}
// default behavior: allow column reordering
var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
itemsSource: data,
frozenColumns: 1
});
document.getElementById("export").addEventListener("click", e => {
theGrid.beginUpdate();
var oldPageSize = theGrid.collectionView.pageSize;
var oldPageIndex = theGrid.collectionView.pageIndex;
theGrid.collectionView.pageSize = 0;
var oldGroupConfig = [];
wijmo.grid.pdf.FlexGridPdfConverter.export(theGrid, "FlexGrid.pdf", {
customCellContent: true,
documentOptions: {
pageSettings: {
layout: wijmo.pdf.PdfPageOrientation.Portrait
},
footer: {
declarative: {
text: '\t&[Page]\\&[Pages]'
}
}
},
embeddedFonts: [{
source: 'https://demo.grapecity.com/wijmo/sample/fonts/ipaexg.ttf',
name: 'ipaexg'
}],
styles: {
cellStyle: {
font: {
family: 'ipaexg'
},
backgroundColor: '#ffffff',
borderColor: '#c6c6c6'
},
altCellStyle: {
backgroundColor: '#f9f9f9'
},
groupCellStyle: {
...