-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·63 lines (57 loc) · 2.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/ecmascript" src="./js/jquery.min.js"></script>
<script type="text/ecmascript" src="./js/jquery.jqGrid.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="./css/jquery-ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="./css/ui.jqgrid.css" />
<script type="text/javascript">
function urlFormatter(cellValue, options) {
return '<a href="http://www.imdb.com/title/' + options.rowId + '" target="_blank">' + cellValue + '</a>';
}
$(document).ready(function () {
$("#jqGrid").jqGrid({
url: 'movieRatings.json',
datatype: 'json',
colNames: ['Title', 'IMDB', 'Meta', 'Runtime'],
colModel: [
{ name: 'title', width: 70, formatter: urlFormatter },
{ name: 'imdbRating', width: 15 },
{ name: 'metaScore', width: 15 },
{ name: 'runtime', width: 15 }
],
//viewrecords: true,
autowidth: true,
height: 'auto',
rowNum: 10000,
loadonce: true,
sortable: true,
sortname: 'imdbRating',
sortorder: 'desc',
jsonReader: { repeatItems: false, id: 'imdbId'},
loadComplete: function () {
var $self = $(this);
if ($self.jqGrid("getGridParam", "datatype") === "json") {
setTimeout(function () {
$self.trigger("reloadGrid"); // Call to fix client-side sorting
}, 50);
}
}
});
});
$(window).bind('resize', function() {
$("#jqGrid").setGridWidth($('#form-box').width() - 30, true);
}).trigger('resize');
</script>
<meta charset="utf-8" />
<title>IMDB Ratings for HBO Movies</title>
</head>
<body>
<div id="form-box">
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
</div>
</body>
</html>