0
我用这个链接来建立一个基本的jqGrid: http://haacked.com/archive/2009/04/14/using-jquery-grid-with-asp.net-mvc.aspx的jqGrid不显示行
这是我的代码:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#list").jqGrid({
url: '/Home/GridData/',
datatype: 'json',
mtype: 'GET',
colNames: ['ProductID', 'ProductName'],
colModel: [
{ name: 'ProductID', index: 'ProductID', width: 40, align: 'left' },
{ name: 'ProductName', index: 'ProductName', width: 40, align: 'left'}],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortname: 'Id',
sortorder: "desc",
viewrecords: true,
imgpath: '/scripts/themes/coffee/images',
caption: 'My first grid'
});
});
public ActionResult GridData(string sidx, string sord, int page, int rows)
{
List<Product> listProducts = new List<Product>(){new Product(){ProductName = "koekies",ProductID = 1},
new Product(){ProductName = "snoepjes",ProductID = 2}};
return Json(listProducts, JsonRequestBehavior.AllowGet);
}
您是否收到错误? – 2011-03-17 07:21:48