jqGrid Example

by fott25

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css">
<link rel="stylesheet" href="http://trirand.com/blog/jqgrid/themes/ui.jqgrid.css">
<script src="http://trirand.com/blog/jqgrid/js/jquery.jqGrid.min.js"></script>
<script src="http://trirand.com/blog/jqgrid/js/i18n/grid.locale-en.js"></script>
<table id="list"></table>
<div id="pager"></div>

JavaScript

var myData = [{
	id: 1,
	name: "aaz"
}, {
	id: 2,
	name: "bbz"
}, {
	id: 3,
	name: "ccz"
}, ];

$("#list").jqGrid({
	datastr: myData,
	datatype: "jsonstring",
	jsonReader: {
		page: function(datastr) {
			return 2;
		},
		total: function(datastr) { 
			return 10; 
		},
	}, 
	colNames: ["Id", "Name"],
	colModel: [{
		name: "id",
		index: "id",
		sorttype: "int"
	}, {
		name: "name",
		index: "name"
	}],
	rowNum:1,
  lastpage: 10,
	caption: "Viz Test",
	pager: '#pager',
});