YUI AutoComplete:选择输入时如何使其展开?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 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
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
这在使用 YUI 3 时有效:
在附加输入 (id) 的焦点上,会触发
query
事件来填充“菜单”并显示它。This works when using YUI 3:
On focus of the attached input (id), the
query
event is fired to populate the 'menu' and display it.