jQuery UI UI在模式UI对话框中自动完成-建议不显示? [英] jquery UI autocomplete inside a modal ui dialog - suggestions not showing?

查看:81
本文介绍了jQuery UI UI在模式UI对话框中自动完成-建议不显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在jquery ui对话框中使用jquery ui自动完成小部件.当我输入搜索文本时,文本框会缩进(ui-autocomplet-loading),但不会显示任何建议.

i am using the jquery ui autocomplete widget inside the jquery ui dialog. when i type in the search text, the textbox indents (ui-autocomplet-loading) but does not show any suggestions.

var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];

$("#company").autocomplete({        
    source : availableTags ,
minLength: 2
});

company是附加自动完成功能的文本框的ID.

company is the id of the textbox to attach the autocomplete.

我认为这可能是z索引,所以我将其设置为:

i thought it might be a z index so i set this:

.ui-autocomplete, .ui-menu, .ui-menu-item {  z-index: 1006; }

,但仍然不显示.我将自动完成功能放在常规"页面中,效果很好.

but it still does not show. i put the autocomplete in a 'regular' page and it works fine.

我正在使用jquery ui版本1.8.2.有关在哪里看的想法?

i am using jquery ui version 1.8.2. any ideas of where to look?

推荐答案

我在搜索同一问题时遇到了这个答案,但是没有一个解决方案正是我想要的.

I came across this answer when searching for this same issue, however none of the solutions were exactly what I wanted.

使用appendTo工作,排序...自动完成项显示在应有的位置,但是它完全将我的对话框窗口扔进了乱七八糟的乱七八糟的div元素.

Using appendTo worked, sorta... The autocomplete items showed up where they were supposed to, however it completely threw my dialog window into a garbled mess of improperly repositioned div elements.

因此,在我自己的css文件中,创建了以下内容:

So in my own css file, I created the following:

ul.ui-autocomplete {
    z-index: 1100;
}

我确定1100有点过分,但我只是想安全地玩.它运作良好并符合K.I.S.S.方法.

I'm sure 1100 is a little overkill, but I just wanted to play it safe. It works well and conforms with the K.I.S.S. method.

我正在将jQuery 1.9.2与jQueryUI 1.10.2一起使用.

I'm using jQuery 1.9.2 with jQueryUI 1.10.2.

这篇关于jQuery UI UI在模式UI对话框中自动完成-建议不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆