JSFiddle - React, Tailwind, and code Playground
HTML
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>Canonical jqGrid example</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.15.2/css/ui.jqgrid.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.15.2/jquery.jqgrid.min.js"></script>
<table id="Grid4"></table>
<table id="pagerGrid4"></table>
JavaScript
// Example from Stackoverflow:
// see: https://stackoverflow.com/q/48647827/1016343
// see: https://free-jqgrid.github.io/getting-started/
// CDN used: https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid
$(function() {
var gridSampleData = [
{ id: 10, firstName: "Jane", lastName: "Doe1"},
{ id: 20, firstName: "Justin", lastName: "Time1" },
{ id: 30, firstName: "Jane", lastName: "Doe2"},
{ id: 40, firstName: "Justin", lastName: "Time2" },
{ id: 11, firstName: "Jane", lastName: "Doe3"},
{ id: 21, firstName: "Justin", lastName: "Time3" },
{ id: 31, firstName: "Jane", lastName: "Doe4"},
{ id: 41, firstName: "Justin", lastName: "Time4" }
];
var rowsPerPage = 4;
var numRows = gridSampleData.length;
var pagedData = {
page:1, total:numRows/rowsPerPage, records: numRows, rows: gridSampleData
}
// simulate AJAX request: use echoUrl instead of real web service
var jsonData = JSON.stringify(pagedData);
var echoUrl = '/echo/js/?js=' + jsonData;
$("#Grid4").jqGrid({ scroll: false, gridview: true,
pager: '#pagerGrid4', rowNum: rowsPerPage, viewrecords: true,
height: 90, width: 400,
colNames: ['First name', 'Last name'],
colModel: [{name: "firstName"}, {name: "lastName"}],
datatype: "json",
jsonReader: {
page: "page",
total: "total",
records: "records",
root: "rows",
repeatitems: false
},
mtype: 'POST',
url: echoUrl
});
});