我刚刚从 jqgrid 3.6.5 移动到网格的 4.4.4 版本。问题是我的选择列表没有填充 dataUrl 选项和 edittype 选择。请看下图
从图中可以看到,grid 已经向 GetManager 和 GetTerritory 发送了两个 ajax 请求,但是结果数据没有显示在选择列表中。我添加了语言文件 jqgrid.min.js 和 grid.formedit.js。以下是其中一种列模型的代码
{ name: 'ManagerId',
//sortable: true,
index: 'ManagerId',
//width: 50,
hidden:true,
align: 'center',
formatter: 'mail',
editable: true,
edittype: 'select',
editoptions: {aysnc:false, dataUrl: '@Url.Action("GetManagers", "Employee")',
buildSelect: function (data) {
var response = jQuery.parseJSON(data.responseText);
var s = '<select>';
s += '<option value="0">--No Manager--</option>';
$($.parseJSON(data.responseText)).map(function () {
s += '<option value="' + this.EmployeeId + '">' + this.EmployeeName + '</option>';
});
return s + "</select>";
}
},
editrules: { required: true,edithidden:true },
formoptions: { elmsuffix: ' *',label:'Manager' }
},
任何人都可以建议它有什么问题。
编辑 1 个
服务器响应
[{"EmployeeId":2,"EmployeeName":"Jack"},{"EmployeeId":4,"EmployeeName":"xe"},{"EmployeeId":1001,"EmployeeName":"John"},{"EmployeeId":2000,"EmployeeName":"Jack"},{"EmployeeId":2001,"EmployeeName":"Jill"}]
响应标头
Cache-Control private
Connection Close
Content-Length 203
Content-Type application/json; charset=utf-8
Date Thu, 14 Feb 2013 13:20:09 GMT
Server ASP.NET Development Server/10.0.0.0
X-AspNet-Version 4.0.30319
X-AspNetMvc-Version 3.0
谢谢