单独执行url:'/Order/GetAllOrders/'时,IE提示下载生成的Json数据,打开后里面是生成好的Json格式数据,但是在jqgrid上就是不显示数据,只显示一个grid框,这个框注脚总页数和总记录数显示为 undefined 。请高手帮忙看看,代码如下:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<link rel="stylesheet" type="text/css" href="/scripts/themes/coffee/grid.css"
title="coffee" media="screen" />
<script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/Scripts/jquery.jqGrid.js" type="text/javascript"></script>
<script src="/Scripts/js/jqModal.js" type="text/javascript"></script>
<script src="/Scripts/js/jqDnR.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#list").jqGrid({
url: '/Order/GetAllOrders/',
datatype: 'json',
mtype: 'GET',
colNames: ['OrderID', 'CustomerID', 'EmployeeID', 'OrderDate', 'RequiredDate', 'ShippedDate', 'ShipVia', 'Freight', 'ShipName',
'ShipAddress', 'ShipCity', 'ShipRegion', 'ShipPostalCode', 'ShipCountry'],
colModel: [{ name: 'OrderID', index: 'OrderID', width: 80 },
{ name: 'CustomerID', index: 'CustomerID', width: 80 },
{ name: 'EmployeeID', index: 'EmployeeID', width: 80 },
{ name: 'OrderDate', index: 'OrderDate', width: 80 },
{ name: 'RequiredDate', index: 'RequiredDate', width: 80 },
{ name: 'ShippedDate', index: 'ShippedDate', width: 80 },
{ name: 'ShipVia', index: 'ShipVia', width: 80 },
{ name: 'Freight', index: 'Freight', width: 80 },
{ name: 'ShipName', index: 'ShipName', width: 80 },
{ name: 'ShipAddress', index: 'ShipAddress', width: 80 },
{ name: 'ShipCity', index: 'ShipCity', width: 80 },
{ name: 'ShipRegion', index: 'ShipRegion', width: 80 },
{ name: 'ShipPostalCode', index: 'ShipPostalCode', width: 80 },
{ name: 'ShipCountry', index: 'ShipCountry', width: 80}],
pager: jQuery("#pager"),
rowNum: 10,
rowList: [10, 20, 30,50],
sortname: 'OrderID',
sortorder: "desc",
viewrecords: true,
imgpath: '/scripts/themes/coffee/images',
caption: 'this is a test'
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
</asp:Content>
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<link rel="stylesheet" type="text/css" href="/scripts/themes/coffee/grid.css"
title="coffee" media="screen" />
<script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/Scripts/jquery.jqGrid.js" type="text/javascript"></script>
<script src="/Scripts/js/jqModal.js" type="text/javascript"></script>
<script src="/Scripts/js/jqDnR.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#list").jqGrid({
url: '/Order/GetAllOrders/',
datatype: 'json',
mtype: 'GET',
colNames: ['OrderID', 'CustomerID', 'EmployeeID', 'OrderDate', 'RequiredDate', 'ShippedDate', 'ShipVia', 'Freight', 'ShipName',
'ShipAddress', 'ShipCity', 'ShipRegion', 'ShipPostalCode', 'ShipCountry'],
colModel: [{ name: 'OrderID', index: 'OrderID', width: 80 },
{ name: 'CustomerID', index: 'CustomerID', width: 80 },
{ name: 'EmployeeID', index: 'EmployeeID', width: 80 },
{ name: 'OrderDate', index: 'OrderDate', width: 80 },
{ name: 'RequiredDate', index: 'RequiredDate', width: 80 },
{ name: 'ShippedDate', index: 'ShippedDate', width: 80 },
{ name: 'ShipVia', index: 'ShipVia', width: 80 },
{ name: 'Freight', index: 'Freight', width: 80 },
{ name: 'ShipName', index: 'ShipName', width: 80 },
{ name: 'ShipAddress', index: 'ShipAddress', width: 80 },
{ name: 'ShipCity', index: 'ShipCity', width: 80 },
{ name: 'ShipRegion', index: 'ShipRegion', width: 80 },
{ name: 'ShipPostalCode', index: 'ShipPostalCode', width: 80 },
{ name: 'ShipCountry', index: 'ShipCountry', width: 80}],
pager: jQuery("#pager"),
rowNum: 10,
rowList: [10, 20, 30,50],
sortname: 'OrderID',
sortorder: "desc",
viewrecords: true,
imgpath: '/scripts/themes/coffee/images',
caption: 'this is a test'
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
</asp:Content>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货