当前位置: 首页 > 知识库问答 >
问题:

剑道组合框内剑道网格编辑不工作

孔睿
2023-03-14

我在剑道格子里有一个剑道组合框。我使用MVVM绑定将组合框绑定到列表中的项目。问题是,当我从combobox下拉列表中选择一个项目时,一切正常,但当我手动在combobox中键入某个内容时,该值不会保存。。。以下是我的网格和组合框代码:

网格:

    $("#specificJoinGrid-" + this.gridID).kendoGrid({
        dataSource: this.dataSource,
        autoBind: true,
        toolbar: ["create"],
        sortable: {
            mode: "multiple",
            allowUnsort: true
        },
        columns: [
            { field: "ToField", title: OlapManagerLabels.Field, width: "20%", editor: fieldDropDownEditor.bind(this), template: "#=ToField#" },
            { field: "SpecificOperator", title: OlapManagerLabels.Operator, width: "15%", editor: operatorDropDownEditor.bind(this), template: "#=OlapManagerNamespace.getOperator(SpecificOperator)#" },
            { field: "SpecificValue", title: OlapManagerLabels.Value, width: "30%", editor: valueDropDownEditor.bind(this), template: "#=SpecificValue#" },
            { field: "SecondSpecificValue", title: OlapManagerLabels.SecondValue, width: "30%", editor: secondValDropDownEditor.bind(this), template: "#=SecondSpecificValue#" },
            { command: { name: "x", width: "5%" } }
        ],
        editable: { createAt: "bottom" },
        edit: function(e) {
            var model = e.model; // access edited/newly added model
            // model is observable object, use set method to trigger change event
            model.ID = BINamespace.guid32();
            model.set("id", model.ID);
        },
        selectable: true
    });

数据来源:

 this.dataSource = new kendo.data.DataSource({
        data: DataSource,
        batch: true,
        schema: {
            model: {
                id: "ID",
                fields: {
                    ToField: { editable: true, required: true },
                    SpecificOperator: { editable: true, required: true, defaultValue: 6 },
                    SpecificValue: { editable: true },
                    SecondSpecificValue: { editable: true },
                    DataSourceID: { defaultValue: this.dataSourceID },
                    ID: {},
                    Type: { defaultValue: 1 },
                    ToTableID: { defaultValue: this.tableID }
                }
            }
        }
    });

组合框:

valueDropDownEditor = function (container, options) {
    var grid = $("#specificJoinGrid-" + this.gridID).data("kendoGrid");
    var row = grid.select();

    if (options.model.SpecificOperator != 1 && options.model.SpecificOperator != 0) {
        $('<input data-text-field="Key" data-value-field="Key" data-bind="value:' + options.field + '"/>')
            .appendTo(container)
            .kendoComboBox({
                autoBind: false,
                dataSource: this.globalsDropDownDS,
                template: "#=Description# (#=Key#)",
                change: value1Changed.bind(this)
            });
    }
    else {
        grid.closeCell(container);
    }
}

共有1个答案

席言
2023-03-14

所以,如果其他人遇到这个问题,我找到了解决办法。一旦我从编辑器中删除了autobind:false属性,组合框就会完全按照需要工作。。不知道为什么我花了这么长时间才弄明白这一点,但希望它能帮助一些人!

 类似资料:
  • 嗨,我正在尝试做剑道网格,但它不工作,显示网格,但没有显示数据。我不知道怎么了。我不知道parametersMap是怎么工作的。请帮帮我。 控制器 这是剧本 Json数据返回:http://localhost:53232/Home/GetGeo?id=5

  • 我想在我的剑道ui网格中进行内联编辑。数据绑定似乎工作正常,但当我在编辑某些内容后单击“更新”按钮时,范围会得到更新,但编辑对话框不会消失。如果单击另一个编辑按钮,它将进入失效状态。毕竟,只有当我至少提供一个伪函数作为k-save时,它才会更新作用域。出于某种原因,单击“取消”按钮确实会更新范围。所以“取消”按钮实现了我对“更新”按钮的期望。 您可能会看到,我想更新客户端的本地范围,而不是向任何服

  • 我无法编辑剑道网格内联和弹出两者。单击“保存”按钮时,我的操作方法无法获取当前编辑单元格的值。 控制器代码: 在控制器中,我只得到空值。请帮帮我,我想使用剑道mvvm教学。

  • 我对剑道网格自定义编辑器有问题。当我点击剑道网格上的编辑按钮时,我想使用dateTimePicker作为我的编辑器。但当我尝试使用dateTimePicker自定义网格时,总会出现错误: 以下是简单的源代码: 或者你可以在这个链接上查看 我已经在许多不同的来源上检查了它,例如: 参考文献1 参考文献2

  • 剑道内嵌单元格编辑不支持日期时间格式。我需要"dd/MMM/yyyy"数据格式,但是剑道网格显示"提交的日期必须是日期"错误。你能告诉我该怎么做吗

  • 我在剑道网格上使用事件来显示几个隐藏的列。然后,我将在事件中再次隐藏它们。 我的问题是,似乎没有取消编辑模式的事件,所以如果用户单击取消,列会被搞砸。 是否有未记录的事件需要取消,还是需要找到解决方案?