Javascript 敲除启用绑定不适用于kendocombobox

Javascript 敲除启用绑定不适用于kendocombobox,javascript,asp.net,knockout.js,kendo-ui,Javascript,Asp.net,Knockout.js,Kendo Ui,combobox是一个复杂的元素,它由多个元素输入、箭头按钮和不可见输入组成,这些不可见输入保持如下所示的值。上面的表达式在不可见输入元素上添加了绑定表达式 Html.Kendo().ComboBoxFor(m => m.CityId).HtmlAttribute("data-bind", "enable: IsCityEnabled") 因此,对模型的更改只会影响不可见的元素 我需要一个通用的解决方案,而不需要向淘汰模型成员添加订阅者。该解决方案提供了 <span class="

combobox是一个复杂的元素,它由多个元素输入、箭头按钮和不可见输入组成,这些不可见输入保持如下所示的值。上面的表达式在不可见输入元素上添加了绑定表达式

Html.Kendo().ComboBoxFor(m => m.CityId).HtmlAttribute("data-bind", "enable: IsCityEnabled")
因此,对模型的更改只会影响不可见的元素


我需要一个通用的解决方案,而不需要向淘汰模型成员添加订阅者。

该解决方案提供了

<span class="k-widget k-combobox k-header">
<span tabindex="-1" unselectable="on" class="k-dropdown-wrap k-state-default k-state-hover">
    <input name="BankId_input" class="k-input valid" type="text" autocomplete="off" maxlength="524288" role="combobox" aria-expanded="false" tabindex="0" aria-disabled="false" aria-readonly="false" aria-autocomplete="both" aria-owns="      BankId_listbox" aria-busy="false" aria-activedescendant="BankId_option_selected" aria-invalid="false" style="width: 100%;">
    <span tabindex="-1" unselectable="on" class="k-select">
        <span unselectable="on" class="k-icon k-i-arrow-s" role="button" tabindex="-1" aria-controls="BankId_listbox">select</span>
    </span>
</span>
<input data-val="true" data-val-number="The field Bank Combo must be a number." id="BankId" name="BankId" no-custom-input="true" data-bind="enable : IsCityReadOnly" type="text" data-role="combobox" aria-disabled="false" aria-readonly="false" style="display: none;" aria-invalid="false" aria-describedby="BankId-error" class="valid">

设身处地为我们着想:你问的问题非常不清楚。请阅读并编辑您的问题以澄清。
        var control = $("#" + ControlName).data("kendoComboBox");
        // configuration of the observer:
        var config = { attributes: true, childList: false, characterData: true };
        // create an observer instance
        var observer = new MutationObserver(function (mutations) {
            mutations.forEach(function (mutation) {
                if (mutation.type === "attributes") {
                    if (mutation.attributeName === "disabled") {
                        control.enable(!mutation.target.disabled);
                        observer.disconnect();
                        observer.observe(control.element[0], config);
                    }
                }
            });
        });
        // pass in the target node, as well as the observer options
        observer.observe(control.element[0], config);