【发布时间】:2021-11-18 05:54:25
【问题描述】:
我的应用程序是 MVC 5,使用 Kendo UI Jquery 可编辑网格。其中一列是下拉列表,使用:
{ field: "ApplicableCourse_ID", title :"Course", values: myDDL1 }
我使用下面的 Ajax 来生成 values 数组 myDDL1
$.ajax({
url: '@Url.Action("GetFreeAccessDropdownList", "fff")',
type: "GET",
async: false,
cache: false,
dataType: "json",
success: function (result) {
myDDL1.push(JSON.stringify(result.Grid1));
var grid = $("#grid").data("kendoGrid");
grid.refresh();
},
error: function (request, status, error) {
alert(request.responseText);
}
});
但是;网格显示值而不是文本。如果我使用静态数组:
var myDDL1 = [
{ "value": 54, "text": "Fuel Spill Response Plan" },
{ "value": 56, "text": "Community Fuel Contractor Manual" },
{ "value": 91, "text": "Blocking and Cribbing" }];
显示正确的文本。动态数组和静态数组有区别吗?
【问题讨论】:
标签: jquery arrays ajax asp.net-mvc kendo-grid