jQueryUI Autocomplete ComboBox Too Long

前端 未结 6 1494
攒了一身酷
攒了一身酷 2020-12-24 05:37

My jQuery UI AutoComplete ComboBox doesn\'t have a scrollbar on the right side and gets very, unfortuantely, long as shown below. I\'d like to restrain this list to a reason

6条回答
  •  礼貌的吻别
    2020-12-24 06:01

    Create your own extension and add the required methods:

    $.widget("custom.combobox",
    $.custom.combobox,
    {
        //Extension metod to add custom css to input
        addInputCss: function (css) {
            this.input.addClass(css);
        },
    
        //Extension metod to add custom css to menu (opened select list)
        addMenuCss: function (css) {
            $(this.input.autocomplete("instance").menu.element).addClass(css);
    
        },
    });
    

    Sample usage:

    $("#yourSelectId").combobox().combobox("addInputCss","yourInputCss").combobox("addMenuCss","yourMenuCss");
    

提交回复
热议问题