【发布时间】:2012-03-09 17:35:15
【问题描述】:
我正在使用 JSON 来检索选择元素的值。
我的colModel 是:
{ name: 'position', editable: true, edittype: "select", formatter:'select',
editoptions: {
value: function() {
var positions;
$.ajax({
url: "orthofixServices.asmx/GetPositionsList",
data: "{}",
async: false,
success: function(data) {
positions = data.d;
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
return positions;
}
这是回复:
{
"d": {
"21": "CAP Pos 1",
"41": "CAP Pos 2",
"42": "CAP Pos 3"
}
}
并且从服务器发回绑定网格的行是
{
"d": {
"page": 1,
"total": 1,
"records": 1,
"rows": [
{
"id": 9,
"name": "Julio",
"nameid": 0,
"title": "Doctor",
"npi": "123-123",
"license": "licabc",
"licstate": "NV",
"position": "41",
"us": false,
"hrate": 0,
"rrate": 0
}
]
}
}
“位置”是提供select 元素的行中的字段。保存该行后,网格上没有显示任何内容。为什么?我应该将选择中的密钥保存为Int 还是String。有关系吗?我尝试了两种方法,我从来没有在网格上为选择元素显示任何内容。它应该显示:"CAP Pos 42"
【问题讨论】: