JSFiddle - React, Tailwind, and code Playground
by Oleg Kiriljuk
HTML
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" href="//rawgit.com/free-jqgrid/jqGrid/master/css/ui.jqgrid.css">
<script src="//rawgit.com/free-jqgrid/jqGrid/master/js/jquery.jqgrid.src.js"></script>
<div class="container">
<table id="categorysummary"></table>
</div>
JavaScript
var serverResponse = {
"page": "1",
"records": "3",
"rows": [
{ "Id": "1", IsActive:'N', CategoryName: "Name 1", "ComboDuration": "83123a" },
{ "Id": "2", IsActive:'N', CategoryName: "Name 3", "ComboDuration": "83432a" },
{ "Id": "3", IsActive:'N', CategoryName: "Name 2", "ComboDuration": "83566a" }
]
},
$grid = $("#categorysummary");
$grid.jqGrid({
url: "/echo/json/", // use JSFiddle echo service
datatype: "json",
mtype: "POST", // needed for JSFiddle echo service
postData: {
json: JSON.stringify(serverResponse) // needed for JSFiddle echo service
},
colNames: ["Id", "Active", "Name", "Duration"],
colModel: [
{ name: 'Id', hidden: true },
{ name: 'IsActive', align: 'center', sortable: false},
{ name: 'CategoryName', sortable: false },
{ name: 'ComboDuration', align: 'center', sortable: false,
classes: "hidden-xs", labelClasses: "hidden-xs" }
],
jsonReader: {
id: 'Id',
repeatitems: false
},
autowidth: true,
rownumbers: true,
sortname: 'Id',
caption: 'Categories',
loadComplete: function () {
$(this).triggerHandler('resize.jqGrid');
},
sortorder: 'asc',
viewrecords: true
}).jqGrid("filterToolbar");
$(window).on('resize.jqGrid', function () {
$grid.jqGrid('setGridWidth', $(".container").width() - 20);
}).triggerHandler('resize.jqGrid');