0
작동하는 dataInit에서 ajax 호출을 통해 데이터를로드하고 모든 것이 올바르게 작동하지만 내 열 (드롭 다운 열만)은 id 값을 설정하지 않습니다.jqGrid onchange (C# MVC)를 선택하지 않음
itemId 및 itemCode 속성이 있습니다. 데이터를로드하고 올바르게 표시하지만 드롭 다운 값을 변경하면 itemId 값을 바인딩하거나 업데이트하지 않습니다.
본질적으로 드롭 다운을 내 ID 열에 바인딩하여 저장할 때 저장할 ID를 얻습니다.
,{
key: false,
hidden: true,
name: 'itemId',
index: 'itemId',
editable: false
}, {
key: false,
name: 'itemCode',
index: 'itemId',
editable: true,
edittype: 'select',
editoptions: {
dataInit: function(element) {
$.ajax({
url: '@Url.Action("GetItems", "Maintenance")',
dataType: 'json',
type: 'POST',
success: function(response) {
var array = response;
if (array != null) {
var i;
for (i in array) {
if (array.hasOwnProperty(i)) {
if (itemId == array[i].id) {
$(element).append("<option value=" +
array[i].id +
" selected>" +
array[i].code +
"</option>");
} else {
$(element).append("<option value=" +
array[i].id +
">" +
array[i].code +
"</option>");
}
}
}
}
}
});
}
},
editrules: { required: true}