我将 JQGrid 与我的 mvc 代码一起使用。
我的控制器是
//
// GET: /Leave/
public ActionResult CompOff()
{
var compoffs = db.RegisterCompOffs.Where(l => l.Employee.Id == this.EmployeeId).ToList();
return Json(compoffs, JsonRequestBehavior.AllowGet);
}</code>
compoffs is not null here..
and my view is
@model AGS.Hrms.Models.RegisterCompOff
@{
ViewBag.Title = "CompOff";
}
<table id="jqgProducts" cellpadding="0" cellspacing="0"></table>
<div id="jqgpProducts" style="text-align:center;"></div>
<script src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#jqgProducts').jqGrid({
//url from wich data should be requested
url: this.href,
//type of data
datatype: 'json',
//url access method type
mtype: 'GET',
//columns names
colNames: ['CompOffDate', 'IsApproved', 'Description', 'ExpiryDate','IsUtilized'],
//columns model
colModel: [
{ name: 'CompOffDate', index: 'CompOffDate', align: 'left' },
{ name: 'IsApproved', index: 'IsApproved', align: 'left' },
{ name: 'Description', index: 'Description', align: 'left' },
{ name: 'ExpiryDate', index: 'ExpiryDate', align: 'left' }
{ name: 'IsUtilized', index: 'IsUtilized', align: 'left' }
],
//pager for grid
pager: $('#jqgpProducts'),
//number of rows per page
rowNum: 10,
//initial sorting column
sortname: 'CompOffDate',
//initial sorting direction
sortorder: 'asc',
//we want to display total records count
viewrecords: true,
//grid height
height: '100%'
});
});
</script></code>
在请求此视图时,我在 Firebug 的控制台窗口中收到此 500 Internal server error。有人可以告诉我我在这里做错了什么吗?