Kendo嵌入式网格组合框TypeError:无法使用“ in”运算符在null中搜索“ Id”

问题描述

grid._schemaMethod = {
    model: {
        id: 'Id',fields: {
            Id: { editable: false,databind:nullableValue: 'Id'},User: { defaultValue: { Id: '',UserFullName: '' } },}
    }
};

grid._columns.push(grid.GridColumn('Id',null,'200px',true));
grid._columns.push(grid.GridColumn('User','User',"#=User.UserFullName#",userNameEditor));
grid._columns.push(grid.GridColumn(null,' ',{ style: 'text-align:right' },['edit','destroy']));

这是我的网格

这是我的javascript函数

function userNameEditor(container,options) {

    var gridDataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: '../Warehouse/SearchUser',dataType: "json"
            },success: function (e) {

            },error: function (e) {

            }
        }
    });
    var cmb = $('<input name="' + options.field + '"/>')
        .appendTo(container)
        .kendoComboBox({
            autoBind: false,dataTextField: "UserFullName",dataValueField: "Id",filter: "contains",minLength: 3,dataSource: gridDataSource,filtering: function (e) {

                var filter = e.filter;
                gridDataSource.read({ userSearchText: filter.value });
                //dataSource.filter({ userSearchText: filter.value });
            },dataBound: function (e) {

                var equipmentData = e.sender.dataSource.data();


                $.each(equipmentData,function (index,selectedEquipmentData) {
                    var dataItem = e.sender.dataSource.at(index);

                });
            },select: function (e) {

                this.refresh();
            },complete: function (e) {

            },error: function (e) {

            }
        }).data('kendoComboBox');
    cmb.refresh();

};

我的问题是,当我单击“更新”按钮时,我的网格给出了错误 TypeError:无法使用“ in”运算符搜索null中的“ Id” ,为什么?我尝试使用.HtmlAttributes(new {data_bind =“ nullableValue:Id”}),但没有用,并且https://www.telerik.com/forums/grid-with-a-custom-dropdownlist-as-an-editor-not-showing-selected-values链接。可以帮助我吗?

解决方法