【发布时间】:2013-02-14 13:02:14
【问题描述】:
我刚刚从 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
谢谢
【问题讨论】:
-
顺便说一句,我已经确认 ajax 请求正在为两个选择列表返回数据
-
您能否在服务器响应中包含详细信息,以便查看响应的标题和正文?了解您在 jqGrid 中使用了哪些 Ajax 设置(如
ajaxSelectOptions)非常重要。 -
奇怪的是也没有js错误
-
我在构建选择中放置了一个警报并显示了它,但从未调用过带有地图功能的第二个警报
标签: jqgrid jqgrid-asp.net