YUI AutoComplete:选择输入时如何使其展开?

发布于 2024-09-03 18:28:31 字数 103 浏览 2 评论 0原文

我有一个 YUI AutoComplete 控件,效果很好。除了我希望它在用户选择输入框后立即扩展建议列表。我怎样才能做到这一点?

目前,只有用户按下框中的按键后才会进行扩展。

I've got a YUI AutoComplete control, works great. Except that I'd like it to expand the list of suggestions as soon as the user selects the input box. How do I make that happen?

Right now expansion doesn't happen until the user hits a key in the box.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

比忠 2024-09-10 18:28:31

您可以使用 textboxFocusEvent 发送以下查询:输入的内容,这将打开结果窗格。我尝试使用 expandContainer 没有成功,但没有成功无论如何,这肯定会起作用。

工作示例: http://tivac.com/yui2/autocomplete_jamesmoore.htm

You can use the textboxFocusEvent to send a query of the contents of the input, which will open the results pane. I tried using expandContainer without success but wasn't sure that would have worked anyways.

Working Example: http://tivac.com/yui2/autocomplete_jamesmoore.htm

一抹苦笑 2024-09-10 18:28:31

Tivac 有正确的想法——使用 textboxFocusEvent 发送一个空查询,该查询返回结果以填充容器。查看此示例以获取一些示例代码: http://developer.yahoo.com /yui/examples/autocomplete/ac_combobox.html

Tivac has the right idea -- use textboxFocusEvent to send an empty query that returns results to populate the container. Check out this example for some sample code: http://developer.yahoo.com/yui/examples/autocomplete/ac_combobox.html

杀手六號 2024-09-10 18:28:31

这在使用 YUI 3 时有效:

Y.one('#id').plug(Y.Plugin.AutoComplete, {source:['item1','item2','item3','etc']})
            .on('focus', function(){this.ac.fire('query')});

在附加输入 (id) 的焦点上,会触发 query 事件来填充“菜单”并显示它。

This works when using YUI 3:

Y.one('#id').plug(Y.Plugin.AutoComplete, {source:['item1','item2','item3','etc']})
            .on('focus', function(){this.ac.fire('query')});

On focus of the attached input (id), the query event is fired to populate the 'menu' and display it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文