working jqGrid Example
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/i18n/grid.locale-en.js"></script>
<script src="http://trirand.com/blog/jqgrid/js/jquery.jqGrid.min.js"></script>
<table id="theGrid" class="scroll">
</table>
<div id="pager" class="scroll" style="text-align: center;">
</div>
CSS
html {
background-color: #e2e2e2;
margin: 0;
padding: 0;
}
body {
background-color: #fff;
border-top: solid 10px #000;
color: #333;
font-size: .85em;
font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
}
a:link, a:visited,
a:active, a:hover {
color: #333;
outline: none;
text-decoration: underline;
}
a:hover {
/* background-color: #c7d1d6; */
}
header, footer, hgroup
nav, section {
display: block;
}
.float-left {
float: left;
}
.float-right {
float: right;
}
.highlight {
background-color: #a6dbed;
padding-left: 5px;
padding-right: 5px;
}
.clear-fix:after {
content: ".";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
h1, h2, h3,
h4, h5, h6 {
color: #000;
margin-bottom: 0;
padding-bottom: 0;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.75em;
}
h3 {
font-size: 1.2em;
}
h4 {
font-size: 1.1em;
}
h5, h6 {
font-size: 1em;
}
#pager_left{width:30%!important;}
/* main layout
----------------------------------------------------------*/
.content-wrapper {
margin: 0 auto;
/*max-width: 960px;*/
}
#body {
background-color: #efeeef;
clear: both;
padding-bottom: 35px;
}
.main-content {
background: url("../images/accent.png") no-repeat;
padding-left: 10px;
}
.featured + .main-content {
background: url("../images/heroaccent.png") no-repeat;
}
footer {
clear: both;
background-color: #e2e2e2;
font-size: .8em;
height: 100px;
}
/* site title
----------------------------------------------------------*/
.site-title {
color: #807A7A;
font-family: Rockwell, Consolas, "Courier New", Courier, monospace;
font-size: 2.3em;
margin: 20px 0;
}
.site-title a, .site-title a:hover, .site-title a:active {
background: none;
color: #807A7A;
outline: none;
text-decoration:...
JavaScript
jQuery(document).ready(function () {
var DataGrid = jQuery("#theGrid");
initDateEdit = function (elem) {
setTimeout(function () {
$(elem).datepicker({
dateFormat: 'dd-M-yy HH:mm:ss',
autoSize: true,
showOn: 'button', // it doesn't work in searching dialog
changeYear: true,
changeMonth: true,
showButtonPanel: true,
showWeek: true,
beforeShowDay: nonWorkingDates
});
}, 100);
};
initDateSearch = function (elem) {
setTimeout(function () {
$(elem).datepicker({ dateFormat: 'dd-M-yy',
autoSize: true,
changeYear: true,
changeMonth: true,
showButtonPanel: true,
showWeek: true,
beforeShowDay: nonWorkingDates
});
}, 100)
};
function nonWorkingDates(date) {
var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
var closedDates = [[0, 0, 0000]];
var closedDays = [[Tuesday], [Wednesday], [Tuesday], [Thursday], [Friday], [Saturday], [Sunday]];
for (var i = 0; i < closedDays.length; i++) {
if (day == closedDays[i][0]) {
return [false];
}
}
for (i = 0; i < closedDates.length; i++) {
if (date.getMonth() == closedDates[i][0] - 1 &&
date.getDate() == closedDates[i][1] &&
date.getFullYear() == closedDates[i][2]) {
return [false];
}
}
return [true];
}
DataGrid.jqGrid({
url: '@Url.Action("GridData")',
datatype: 'json',
mtype: 'GET',
//'PO ID',
colNames: ['ID', 'Week Start', 'Plu', 'Case Qty', ''],
...