【发布时间】:2011-05-22 08:37:59
【问题描述】:
我正在尝试使用 SELECT 元素填充 jqGrid 搜索表单。在我感兴趣的列的 colModel 中
searchoptions: {
dataUrl: '<%: Url.Content("~/Contact/GetCustomers") %>',
buildSelect: function (response) {
var theSelect = "<select>";
$.each(response, function (i, data) {
theSelect += '<option value="' + data.Value + '">' + data.Text + '</option';
});
theSelect += "</select>";
},
sopt: ['eq', 'ne']
}
远程方法GetCustomers返回一个json结果,格式为
[{"Selected":false,"Text":"David Gilmour","Value":"10"},
{"Selected":false,"Text":"Eric Clapton","Value":"26961"},
{"Selected":false,"Text":"Joan Baetz","Value":"26972"}]
但是使用我用于每个函数的代码,我收到以下错误
【问题讨论】:
-
传入的
response的值是多少?你能告诉我们它在你的调试器中是什么样子吗? -
上面写着
[object XMLhttpRequest]