Selectize.js无法下拉弹出窗口

时间:2015-09-16 17:52:35

标签: javascript jquery twitter-bootstrap

我有一个Selectized选择,它没有显示带有选项的弹出窗口,即使我可以在调试器中看到选择的控件包含所需的选项。当我单击下拉按钮时,箭头指向显示列表时的向上,但这就是它所做的一切,并且不显示包含选项列表的弹出窗口。此下拉列表也位于引导模式对话框中。以下代码段显示了Selectize下拉列表初始化和选择。第一部分初始化控件。

enter image description here

以下加载选项数组:

enter image description here

这是选择发生的地方。首先,我们调用初始化方法来加载选项,然后使用生成的实例化控件来创建选择控件:

enter image description here

顺便说一下,我在另一个页面上有相同的代码,但我不知道为什么它在这个页面中不起作用。两种情况下的代码都相同。

文本格式的代码:

var sgAllSelectize = [];

var pplicationId = null;

function bindAllSGContainer(appId, option) {
    /* ok, so we loaded the SG select element, time to selectize it */
    var handler;
    var pageType = $("#hdnPageType").val();
    if (pageType == 'clone') {
        handler = onChangeSGidForAllServer;
    }
    if (pageType == 'migration') {
        handler = onChangeMigrationSGidForAllServer;
    }
    if (pageType == 'failover') {
        handler = onChangeFailoverSGidForAllServer;
    }

    var element = "#allServerSGselect_" + appId;
    applicationId = appId;

    var $vs = $(element).selectize({
        create: true,
        sortField: 'text',
        placeHolder: 'Example: sg-00000000',
        persist: false,
        options: option,
        createOnBlur: true,
        allowEmptyOption: false,
        closeAfterSelect: true,
        onChange: function (input) {
            var aid = appId;
            var sgValid = input.search(/^sg-[a-zA-Z0-9]{8}$/i);
            var sg_selection = $("option", element);
            var sg_selection_stripped = sg_selection.val().slice(0, 11);
            if (sgValid == 0) {
                sg_selection.val(sg_selection_stripped);
                handler(input, aid);
            } else {
                console.log("sg " + input + " is not valid");
                this.removeOption(input, "silent");
                this.setValue("");
                /* sending an empty sg id will disable the sg elements */
                handler("", aid);
            }
        }
    });
    sgAllSelectize[appId] = $vs;
}


var allOptsArray = [];

//load up the options into an object array
for (var h = 0; h < str1.length; h++) {
    optAllSgObject = new Object(); 
    optAllSgObject.text = str1[h];
    optAllSgObject.value = str1[h];
    allOptsArray.push(optAllSgObject);
}
    bindAllSGContainer(appId, allOptsArray);
    var o = sgAllSelectize[appId];
    selectizeAll = o[0].selectize;

1 个答案:

答案 0 :(得分:0)

答案隐藏在评论中。

周围的单元格或表格有溢出:隐藏。确保将其设置为溢出:可见。