如何以编程方式打开 vaadin 组合框 [英] How to open a vaadin combobox programmatically

查看:23
本文介绍了如何以编程方式打开 vaadin 组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用组合框实现了一个poor-mans-searchbox.将搜索表达式输入到文本字段中,然后用户按 Enter.然后将搜索表达式添加到组合模型中,这在事件处理程序中被捕获,然后运行搜索,清空组合列表并用搜索结果填充它.但是,用户随后需要手动打开组合列表(通过按下小向下箭头)以查看结果.自动打开列表会很好,但我还没有找到如何做到这一点.有人知道吗?

I have implemented a poor-mans-searchbox using a combobox. The search expression is typed into the textfield and the user press enter. Then the search expression is added to the combo model, this is caught in the eventhandler which then runs the search, empties the combo list and populates it with the searchresults instead. However, the user then need to open the combo list manually (by pressing the little down-arrow) to see the result. It'd be nice to open the list automatically, but I haven't found out how to do that. Does anyone know?

此外,每次用户按下一个键时都应该执行搜索,而不仅仅是在按下 Enter 之后.

Also the search should be performed each time the user presses a key, and not only after enter is pressed.

推荐答案

vaadin-combo-box 组件提供了一个名为open"的方法,因此只需调用

the vaadin-combo-box component offers a method called "open" so simply call

reference-to-element.open();

reference-to-element.open();

应该可以.

相关官方文档在这里:https://www.webcomponents.org/element/vaadin/vaadin-combo-box/elements/vaadin-combo-box#method-open

这篇关于如何以编程方式打开 vaadin 组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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