簡體   English   中英

劍道網格內的劍道組合框編輯不起作用

[英]Kendo Combobox inside kendo grid edit not working

我在劍道網格中有一個劍道組合框。 我使用MVVM綁定將組合框綁定到列表中的項目。 問題是,當我從組合框下拉列表中選擇一個項目時,一切都很好,但是當我在組合框中手動鍵入內容時,該值無法保存...這是我的網格和組合框代碼:

格:

    $("#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);
    }
}

因此,以防萬一其他人遇到此問題,我找到了解決方案。 一旦我從編輯器中刪除了autobind: false屬性,組合框autobind: false工作。.不確定為什么花了我這么長時間才能弄清楚這一點,但希望它能對大家有所幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM