tesicg
tesicg

Reputation: 4053

How to add new parameter to combo box that extends Kendo combo box?

I have the code as following:

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

I would like to connect "readonly" parameter (there is ? now) with preventEnteringTextInVatType function. How to do it?

Upvotes: 1

Views: 176

Answers (1)

Carsten Franke
Carsten Franke

Reputation: 1669

Have you tried the suggestions from https://www.telerik.com/forums/make-combobox-non-editable? The linked demo on http://dojo.telerik.com/@ggkrustev/Axobi seems to do exactly what you want.

Upvotes: 1

Related Questions