下拉字段选择/返回null剑道ui网格mvc

Dropdown field select/returns null kendo ui grid - mvc

本文关键字:剑道 ui 网格 mvc null 返回 字段 选择      更新时间:2023-09-26

我正在剑道ui网格上工作,下拉框填充了来自api调用.....的数据问题是,

选择的项值没有传递给viewModel或传递空值

我正在做一些可怕的事情,请帮助…谢谢你的时间:)

脚本

...
    schema: {
        model: {
            id: "ProjectId",
            fields: {
                ProjectId: { editable: true, nullable: false, type: "number" },
                ClientId: { editable: true, nullable: false, type: "number" },
                Name: { editable: true, nullable: true, type: "string" },
               // Status: { editable: true, nullable: true, type: "string" },
               Status: { editable: true, nullable: true, type: "string", defaultValue: { StatusId: "NotCompleted"}},
               IsActive: { editable: true, nullable: false, type: "boolean" },
            }
        }
    }
});
$("#grid").kendoGrid({
    dataSource: dataSource,
    pageable: true,
    toolbar: ["create"],
    scrollable: false,
    sortable: true,
    groupable: true,
    filterable: true,
    columns: [
        { field: "Name", title: "Project Name", width: "170px" },
        //{ field: "Status", title: "Status", width: "110px" },
         { field: "Status", title: "Status", width: "150px", editor: statusDropDownEditor },
        { field: "IsActive", title: "Active", width: "50px" },
        { command: "", template: "<a href='Project/Task'>Manage Task</a>", width: "30px", filterable: false },
        { command: "", template: "<a href='Project/Setting'>Setting</a>", width: "30px", filterable: false },
        { command: ["edit", "delete"], title: "&nbsp;", width: "80px" }
    ],
    editable: "popup"
});
function statusDropDownEditor(container, options) {
    $('<input required data-value-field="StatusID" data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            autoBind: false,
            dataSource: {
                type: "odata",
                transport: {
                    read: "/api/dropdown/GetProjectStatus"
                }
            }
        });
}

你有没有把

 dataTextField: "name",
 dataValueField: "id"

?