Kendo ui 剑道格网自定义编辑发送[对象]

Kendo ui 剑道格网自定义编辑发送[对象],kendo-ui,grid,editor,Kendo Ui,Grid,Editor,我想实现剑道网格自定义编辑器(dropdownlist) 一切正常,但若创建新记录或更新记录存在,当下拉列为空时,我在更新中看到错误,在调试中看到 “[object]”作为列的值发送, 但当下拉列表有值时,我可以更改下拉列表的值并更新记录 我的代码是: var crudServiceBaseUrl = "http://localhost:8090/hr"; var countryDataSource = new kendo.data.DataSource({

我想实现剑道网格自定义编辑器(dropdownlist)

一切正常,但若创建新记录或更新记录存在,当下拉列为空时,我在更新中看到错误,在调试中看到 “[object]”作为列的值发送, 但当下拉列表有值时,我可以更改下拉列表的值并更新记录

我的代码是:

var crudServiceBaseUrl = "http://localhost:8090/hr";

var countryDataSource = 
        new kendo.data.DataSource({
                transport: {
                            parameterMap: function(options, operation) {
                                if (operation !== "read" && options.models) {
                                    return {
                                        models: kendo.stringify(options.models)
                                    };
                                }
                            },
                            read: {
                                    url: crudServiceBaseUrl + "/countries",
                                    dataType: "jsonp"
                                },
                                update: {
                                    url: crudServiceBaseUrl + "/countries/Update",
                                    dataType: "jsonp"
                                },
                                destroy: {
                                    url: crudServiceBaseUrl + "/countries/Destroy",
                                    dataType: "jsonp"
                                },
                                create: {
                                    url: crudServiceBaseUrl + "/countries/Create",
                                    dataType: "jsonp"
                                }
                },
                schema   : {
                    data  : "items"
                    },
                model: {id : "CD_CONT",
                        fields: { 
                           CD_CONT : { type: "string",editable : false}, 
                           NAME_CONT : { type: "string",editable : true,nullable : false}, 
                           CONTINENT : { type: "string",editable : true,nullable : true}
                        }
                    }
            });


var continentDataSource = new kendo.data.DataSource({
    data: [ { continent:"1",name:"asia"},
            { continent:"2",name:"europ"},
            { continent:"3",name:"america"}
          ]
});

$('#grid).kendoGrid({
            toolbar: ["create","save", "cancel",],
            columns: [
                {
                    field: "CD_CONT" ,
                    title: "Cd cont"  
                },
                {
                    field: "NAME_CONT" ,
                    title: "Name cont" 
                },
                {
                    field: "CONTINENT" ,
                    title: "Continent",
                    editor: function ContinentDropDown(container, options) {
                                        $('<input data-text-field="name" data-value-field="continent" data-bind="value:' + options.field + '"/>')
                                            .appendTo(container)
                                            .kendoDropDownList({
                                                dataSource: continentDataSource,
                                                dataTextField: "name",
                                                dataValueField: "continent"
                                            });
                                    }
                }
                ],
            dataSource: countryDataSource ,
            editable: "inline"
        });
var crudServiceBaseUrl=”http://localhost:8090/hr";
变量countryDataSource=
新建kendo.data.DataSource({
运输:{
parameterMap:功能(选项、操作){
if(操作!=“读取”&&options.models){
返回{
模型:kendo.stringify(options.models)
};
}
},
阅读:{
url:crudServiceBaseUrl+“/countries”,
数据类型:“jsonp”
},
更新:{
url:crudServiceBaseUrl+“/countries/Update”,
数据类型:“jsonp”
},
销毁:{
url:crudServiceBaseUrl+“/countries/Destroy”,
数据类型:“jsonp”
},
创建:{
url:crudServiceBaseUrl+“/countries/Create”,
数据类型:“jsonp”
}
},
模式:{
数据:“项目”
},
型号:{id:“CD_CONT”,
字段:{
CD_CONT:{type:“string”,可编辑:false},
NAME_CONT:{type:“string”,可编辑:true,可空:false},
大陆:{type:“string”,可编辑:true,可空:true}
}
}
});
var-DataSource=new kendo.data.DataSource({
数据:[{大陆:“1”,名称:“亚洲”},
{大陆:“2”,名称:“欧洲”},
{大陆:“3”,名字:“美洲”}
]
});
$('#网格).kendoGrid({
工具栏:[“创建”、“保存”、“取消”、],
栏目:[
{
字段:“CD_CONT”,
标题:“Cd续”
},
{
字段:“名称\续”,
标题:“名称续”
},
{
字段:“大陆”,
标题:“大陆”,
编辑器:函数下拉列表(容器、选项){
$('')
.appendTo(容器)
.kendoDropDownList({
数据源:数据源,
dataTextField:“名称”,
dataValueField:“大陆”
});
}
}
],
数据源:countryDataSource,
可编辑:“内联”
});

另外,如何设置字段模板以在网格中显示大陆的文本值?

您是否忘记在编辑器中添加
名称

$('<input data-text-field="name" data-value-field="continent" data-bind="value:' + options.field + '" name='" + options.field + "'/>')
$(“”)