I am using Craig Stuntz article on Using jqGrid with ASP.NET MVC: Search and Formatting, http://blogs.teamb.com/craigstuntz/2009/04/27/38243/ Using HttpFox I can see the json data being returned successfully but it will not display in the grid. The displays fine, but with no data and page numbers. Can anyone see a problem with this
$(document).ready(function() {
$("#grid").jqGrid({
url: '/Grid/DynamicGridData/',
datatype: 'json',
mtype: 'GET',
colNames: ['EnquiryID', 'FirstName', 'Surname', 'PostCode'],
colModel: [
{ name: 'EnquiryID', index: 'EnquiryID', width: 80, align: 'left' },
{ name: 'FirstName', index: 'FirstName', width: 150, align: 'left' },
{ name: 'Surname', index: 'Surname', width: 150, align: 'left' },
{ name: 'PostCode', index: 'PostCode', width: 150, align: 'left'}],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortname: 'EnquiryID',
sortorder: "desc",
viewrecords: true,
imgpath: '/scripts/themes/steel/images',
caption: 'My first grid'
});
$("#search").filterGrid("#grid", {
gridModel: false,
filterModel: [{
label: 'Search',
name: 'search',
stype: 'text'
}]
});
});
Calling the above:
<script language="javascript" type="text/javascript" src="<%= Url.Content ("~/Scripts/Home.GridDemo.js") %>"></script>
<div id="search"></div>
<table id="grid" cellpadding="0" cellspacing="0"></table>
<div id="pager" style="text-align:center;"></div>