0

我有以下 JSFiddle 示例。如何处理 KendoUI DropDownList? http://jsfiddle.net/bryanb/bWRTm/1/

我没有运气就尝试了以下方法:

supplier: <input id="suppliers1" class="suppliers" value="2" />
<br />
supplier: <input id="suppliers2" class="suppliers" value="2" />
<br />
<button id="dispose">Dispose</button>

js:

function comboboxDispose() {
    $(".suppliers").each(function () {
        var combobox = $(this).data("kendoComboBox"),
            popup = combobox.popup,
            element = popup.wrapper[0] ? popup.wrapper : popup.element;

        //remove popup element;
        element.remove();

        //unwrap element
        combobox.element.show().insertBefore(combobox.wrapper);
        combobox.wrapper.remove();

        combobox.element.removeData("kendoComboBox");
    });
}
4

1 回答 1

0

我想通了。初始化 kendoui 组合框后,我的选择器选择了错误的元素。这是修复:

function comboboxDispose() {
    $("input[class='suppliers']").each(function () {

        var combobox = $(this).data("kendoComboBox"),
            popup = combobox.popup,
            element = popup.wrapper[0] ? popup.wrapper : popup.element;

        //remove popup element;
        element.remove();

        //unwrap element
        combobox.element.show().insertBefore(combobox.wrapper);
        combobox.wrapper.remove();

        combobox.element.removeData("kendoComboBox");
    });
}

工作示例:http: //jsfiddle.net/bryanb/bWRTm/2/

于 2013-02-27T04:31:07.870 回答