Angularjs 带有自定义下拉列的KendoUI网格传递整个对象而不是Id

Angularjs 带有自定义下拉列的KendoUI网格传递整个对象而不是Id,angularjs,kendo-ui,kendo-grid,odata,breeze,Angularjs,Kendo Ui,Kendo Grid,Odata,Breeze,我正在使用剑道UI和Angular/Breeze。我有一个可编辑的网格,其中一列是下拉菜单。在进行保存之前,一切正常。问题是我的odata呼叫期望: Id(guid), Name, Description, CategoryId(guid) 更改下拉列表时,它会触发一个save命令并按如下方式发回: Id(guid), Name, Description, Category(categoryId, Name, Desc) 在何处以及如何使网格仅发回`categoryId而不是整个catego

我正在使用剑道UI和Angular/Breeze。我有一个可编辑的网格,其中一列是下拉菜单。在进行保存之前,一切正常。问题是我的odata呼叫期望:

Id(guid), Name, Description, CategoryId(guid)
更改下拉列表时,它会触发一个save命令并按如下方式发回:

Id(guid), Name, Description, Category(categoryId, Name, Desc)
在何处以及如何使网格仅发回`categoryId而不是整个category对象

    vm.columns = [
        { field: 'name', title: 'name' },
        { field: 'desc', title: 'description' },
        {
            field: 'categoryId',
            title: 'group',
            template: getCategory,
            editor: categoryDropDown
        }
    ];

    function categoryDropDown(container, options) {
        $('<input data-text-field="categoryName" data-value-field="categoryId" data-bind="value:' + options.field + '"/>')
            .appendTo(container)
            .kendoDropDownList({
                dataTextField: "categoryName",
                dataValueField: "categoryId",
                dataSource: vm.categories
            });
    }

    function getCategory(item) {
        for (var i = 0, length = vm.category; i < length; i++) {
            console.log(vm.categories[i].categoryId);
            if (vm.categories[i].categoryId === item.categoryId) {
                return vm.categories[i].categoryName;
            }
        }
        return '';
    }

那是丢失的钥匙

    function categoryDropDown(container, options) {
       $('<input data-text-field="categoryName" data-value-field="categoryId" data-bind="value:' + options.field + '"/>')
           .appendTo(container)
           .kendoDropDownList({
               dataTextField: "categoryName",
               dataValueField: "categoryId",
               dataSource: vm.categories,
               valuePrimitive: true
           });
    }
function categorhydropdown(容器、选项){
$('')
.appendTo(容器)
.kendoDropDownList({
dataTextField:“categoryName”,
dataValueField:“类别ID”,
数据源:vm.categories,
valuePrimitive:对
});
}

在模型中,尝试将类型设置为string categoryId:{editable:true,键入:“string”},非常感谢。我在想:你在哪里找到那处房产的?我在谷歌上查了一下,找不到任何配置属性列表之类的东西,我记不得了。我想我只是碰巧看到了一个例子,然后碰巧查了一下。
    function categoryDropDown(container, options) {
       $('<input data-text-field="categoryName" data-value-field="categoryId" data-bind="value:' + options.field + '"/>')
           .appendTo(container)
           .kendoDropDownList({
               dataTextField: "categoryName",
               dataValueField: "categoryId",
               dataSource: vm.categories,
               valuePrimitive: true
           });
    }