Html Grid
Set the source property of the jqxGrid.
Author: http://jqwidgets.com
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="jqxgrid"></div>
JavaScript
var data=[{
firstname: 'AAA1',
lastname: 'AAA1',
productname: 'AAA1'
},
{
firstname: 'BBB1',
lastname: 'BBB1',
productname: 'BBB1'
}];
var source = {
localdata: data,
datafields: [{
name: 'firstname',
type: 'string'
}, {
name: 'lastname',
type: 'string'
}, {
name: 'productname',
type: 'string'
}],
totalrecords : 10,
datatype: "json"
};
var adapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({
width: 500,
theme: 'energyblue',
source: adapter,
autorowheight : true,
autoheight : true,
selectionmode: 'checkbox',
virtualmode : true,
pageable : true,
pagesize : 2,
pagesizeoptions : [2],
rendergridrows : function (params) {
return params.data;
},
columns: [{
text: 'First Name',
datafield: 'firstname'
}, {
text: 'Last Name',
datafield: 'lastname'
}, {
text: 'Product',
datafield: 'productname'
}]
});
$("#jqxgrid").on("pagechanged", function (event){
var num = $("#jqxgrid").jqxGrid('getpaginginformation').pagenum+1;
source.localdata =[{
firstname: 'AAA'+num,
lastname: 'AAA'+num,
productname: 'AAA'+num
},
{
firstname: 'BBB'+num,
lastname: 'BBB'+num,
productname: 'BBB'+num
}];
$("#jqxgrid").jqxGrid({ source: source });
});