【发布时间】:2011-05-25 12:26:41
【问题描述】:
当用户尝试在详细 jqGrid 中添加新记录时,我正在尝试动态填充下拉列表。这是我到目前为止所拥有的。它可以很好地提取数据,但它不会将值设置为下拉列表。任何帮助将不胜感激。
beforeShowForm: function(formid) {
var sr = $("#list").jqGrid('selrow');
if (sr) {
// get data from master
var UserID = $("#list").getGridParam('selrow');
var roles = $.ajax({ type: "POST",
url: '<%= ResolveUrl("~/Admin/GetRoles/") %>' + UserID,
dataType: "json",
async: false,
success: function(data) {
}
}).responseText;
// set the field in detail with the value of mnaster
$("#UserID", formid).val(UserID);
// try and populate dropdown
$('#detail').setColProp('Description', { editoptions: { value: roles} });
} else {
// close the add dialog
alert("no row is selected");
}
}
【问题讨论】:
标签: javascript jqgrid