如何在扩展Kendo组合框的组合框中添加新参数?

时间:2018-10-10 09:13:01

标签: javascript kendo-ui

我的代码如下:

(function () {
    "use strict";
    function comboBox() {
        comboBox.superclass.constructor.apply(this, arguments);
        this.params = $.extend(true, {
            suggest: true,
            highlightFirst: true,
            filter: "contains",
            minLength: 0,
            width: "auto"
        }, this.params);

        this.tControl = this.fn.kendoComboBox({
            change: $.proxy(this.onChange, this),
            minLength: this.params.minLength,
            filter: this.params.filter,
            suggest: this.params.suggest,
            highlightFirst: this.params.highlightFirst,
            dataSource: this.params.dataSource.data,
            dataTextField: this.params.dataTextField || "Text",
            dataValueField: this.params.dataValueField || "Value",
            template: this.params.template,
            clearButton: this.params.clearButton,
            width: this.params.width,
            readonly: ?
        }).data("kendoComboBox");

        this.tControl.list.width(this.params.width);
    }

    extend(comboBox, ui.WrappedControl);

    // ?
    comboBox.prototype.preventEnteringTextInVatType = function () {
        this.childs.vatType.tControl.input.attr("readonly", true);
    };

    ui.ComboBox = comboBox;
})();

我想用preventEnteringTextInVatType函数连接“只读”参数(现在有?)。怎么做?

1 个答案:

答案 0 :(得分:1)

您是否尝试过https://www.telerik.com/forums/make-combobox-non-editable的建议? http://dojo.telerik.com/@ggkrustev/Axobi上的链接演示似乎完全可以满足您的要求。