jQuery Grid
Set the scrollmode property of the jqxGrid. Author: http://jqwidgets.com
by John Dow
HTML
<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="https://jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<div id='jqxWidget'>
<div id="jqxgrid"></div>
</div>
<div style='margin-left: 10px; float: left;'>
<input type="button" value="Export to PDF" id='pdfExport' />
</div>
CSS
.yellowCell {
background-color: yellow;
}
JavaScript
var data = generatedata(2000000);
for(var i=0;i<data.length; ++i) {
data[i]['idx'] = i;
}
var source = {
localdata: data,
datafields: [{
name: 'idx',
type: 'number'
}, {
name: 'firstname',
type: 'string'
}, {
name: 'lastname',
type: 'string'
}, {
name: 'productname',
type: 'string'
}, {
name: 'date',
type: 'date'
}, {
name: 'quantity',
type: 'number'
}, {
name: 'price',
type: 'number'
}],
datatype: "array"
};
//var myGrid
var cellclassname = function (row, column, value, data) {
var val = $('#jqxgrid').jqxGrid('getcellvalue', row, "quantity");
if (val > 9) {
return "yellowCell";
}
}
var adapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({
width: 670,
theme: 'energyblue',
scrollmode : 'logical',
source: adapter,
sortable: true,
columns: [{
text: 'Idx',
datafield: 'idx',
width: 90,
cellclassname: cellclassname,
},{
text: 'First Name',
datafield: 'firstname',
width: 90,
cellclassname: cellclassname,
}, {
text: 'Last Name',
datafield: 'lastname',
width: 90,
cellclassname: cellclassname,
}, {
text: 'Product',
datafield: 'productname',
width: 170,
cellclassname: cellclassname,
}, {
text: 'Order Date',
datafield: 'date',
width: 160,
cellsformat: 'dd-MMMM-yyyy',
cellclassname: cellclassname,
}, {
text: 'Quantity',
datafield: 'quantity',
width: 80,
cellsalign: 'right',
cellclassname: cellclassname,
}, {
text: 'Unit Price',
datafield: 'price',
cellsalign: 'right',
...