$(function() {
"use strict";
$("#grid").jqGrid({
colModel: [{
name: "id",
width: 20,
editable: true,
editoptions: {
size: 3 // doesn't get honored
}
},
{
name: "firstName",
width: 200,
editable: true
},
{
name: "lastName",
width: 200,
editable: true
}
],
data: [{
id: 10,
firstName: "Angela",
lastName: "Merkel"
},
{
id: 20,
firstName: "Vladimir",
lastName: "Putin"
},
{
id: 30,
firstName: "David",
lastName: "Cameron"
},
{
id: 40,
firstName: "Barack",
lastName: "Obama"
},
{
id: 50,
firstName: "François",
lastName: "Hollande"
}
],
pager: true,
pgbuttons: false,
pginput: false,
viewrecords: true,
pagerRightWidth: 90
})
.jqGrid('navGrid', {
edittext: 'Edit',
addtext: 'Add',
deltext: 'Del',
search: false,
view: true,
viewtext: 'View',
refresh: true,
refreshtext: 'Refresh'
});
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.15.4/css/ui.jqgrid.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.15.4/jquery.jqgrid.min.js"></script>
<table id="grid"></table>
<div id="pager"></div>