Vaadin 组合框 [英] Vaadin combobox

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

问题描述

我想创建带有 2 个分隔符的 Vaadin 下拉列表.我找不到实现它的方法,有人能帮我解决这个问题吗?

I want to create Vaadin drop down with 2 separators in it. I couldn't find a way to implement that, can anyone help me to solve this issue?

这是我想要显示下拉列表的方式:

This is the way I want to display my drop down:

  • 选项 1
  • 选项 2
  • ------------;
  • 选择 1
  • 选择 2
  • -----------;
  • 第 1 组

我该怎么做?

推荐答案

没有向选择添加分隔符的内置方法.我能想到的唯一方法是添加一个带有所需分隔符的项目作为其标题.例如,如果您使用默认标题(项目 ID) select.addItem("-----"); 应该就足够了.这应该适用于 ComboBox 和 NativeSelect.

There is no built-in way to add separators to selects. The only way I can think of is to add an item with the desired separator as its caption. For example if you use the default caption (item id) select.addItem("-----"); should be enough. This should work for both ComboBoxes and NativeSelects.

这篇关于Vaadin 组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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