0
我已經從Web服務提取數據到客戶端,最初我顯示在警告框中,但現在我需要顯示數據在jqGrid表示,請檢查我的代碼是否我需要改變任何事情。如何檢索客戶端使用jqgrid的所有數據
<head id="head1" runat="server">
<title></title>
<script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="Scripts/grid.local-en.js" type="text/javascript"></script>
<script src="Scripts/jquery.jqgrid.min.js" type="text/javascript"></script>
<link href="Scripts/jqgrid/jqgrid.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#grid").jqGrid({
url:"Name.asmx/Display",
datatype:"json",
type:'GET',
colNames:['eid', 'ename', 'dob', 'addr', 'pincode', 'dsgid', 'salary', 'doj'],
colModel:[
{ name: 'eid', index: 'id', width: 55, sortable: false, editable: false, editoptions: { readonly: true, size: 10} },
{ name: 'ename', index: 'ename', width: 200, editable: false },
{ name: 'dob', index: 'dob', width: 200, editable: true },
{ name: 'addr', index: 'addr', width: 100, editable: true },
{ name: 'pincode', index: 'pincode', width: 300, editable: true },
{ name: 'type', index: 'type', width: 200, editable: true},
{ name: 'dsgid', index: 'dsgid', width: 200, editable: true },
{ name: 'salary', index: 'salary', width: 100 },
{ name: 'doj', index: 'doj', width: 100 },
],
jsonReader: {
repeatitems: false
},
rowNum: 10,
rowList: [10, 20, 30],
pager: jQuery('#gridpager'),
sortname: 'ename',
viewrecords: true,
loadonce:true,
sortorder: "asc",
caption: "customerdetails",
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>
AJAX call test page</h2>
<div id="jqgrid">
<table id="grid">
</table>
<div id="gridpager">
</div>
</div>
</div>
</form>
</body>
</html>
你收到什麼錯誤? – Wahab 2014-09-02 05:53:16
@Wahab如果我運行這段代碼,它會顯示像「Microsoft JScript運行時錯誤:對象不支持此屬性或方法」 – Ahalya 2014-09-02 06:02:34
是json你是否返回有效? – Wahab 2014-09-02 06:05:43