I have included following libraries files:
<script src="JQuery/jquery-1.5.1.js" type="text/javascript"></script>
<script src="jQuery/src/i18n/grid.locale-en.js" type="text/javascript" charset="utf-8"> </script>
<script src="JQuery/jqgrid_demo38/js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script src="JQuery/js/jquery.jqGrid.src.js" type="text/javascript"></script>
Using following code to create the grid:
jQuery(document).ready(function(){
jQuery("#list2").jqGrid({
url: 'http://localhost:8001/resource/abc/entries',
mtype: 'GET',
datatype: "json",
colNames: ['Trans ID', 'ACC ID', 'Day ID', 'Date', 'Balance'],
colModel: [
{ name: 'Trans_ID', index: 'Trans_ID', width: 130 },
{ name: 'ACC_ID', index: 'ACC_ID', width: 100 },
{ name: 'Day_ID', index: 'Day_ID', width: 100 },
{ name: 'Summary_Date', index: 'Summary_Date', width: 90 },
{ name: 'Balance', index: 'Balance', width: 85 }
],
width: 700,
heigth: 200,
imgpath: "jqgrid_demo38/themes/redmond/images",
loadonce: true,
rownumbers: true,
rownumWidth: 40,
gridview: true,
multiselect: false,
paging: true,
pager: jQuery('#pager2'),
rowNum: 20,
rowList: [10, 30, 50],
scrollOffset: 0,
sortname: 'Summary_Date',
sortorder: "desc",
viewrecords: true,
caption: "Demo"
});
});
using the following code to define the grid in HTML
<table id="list2" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager2" class="scroll" style="text-align:center;"></div>
Page returns an empty grid with just column heading and without any data from rest service
when clicked on web service link, it returns following data
[
{
"Trans_ID": 1,
"ACC_ID": 1,
"Day_ID": 1,
"Summary_Date": "2011-05-08",
"Balance": 100.0
},
{
"Trans_ID": 2,
"ACC_ID": 2,
"Day_ID": 1,
"Summary_Date": "2011-04-08",
"Balance": 50.0
}
]