Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vaadin combobox

Tags:

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:

  • Option 1
  • Option 2
  • ------------;
  • select 1
  • select 2
  • -----------;
  • group 1

How can I do that?

like image 601
123Ex Avatar asked Aug 22 '11 09:08

123Ex


2 Answers

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.

like image 67
ripla Avatar answered Sep 19 '22 06:09

ripla


You can implement a new Vaadin component including the client behaviour, but this is not an easy solution. This page https://vaadin.com/book/-/page/gwt.html of "Book of Vaadin" and Vaadin forum can help for that.

Also, creating your own component using existing components is another solution. You can implement a special combobox which takes values of String or Component arrays. The way of doing this is using Vaadin panels, layouts and windows with size and locations and click listeners.

like image 31
cagdas basaraner Avatar answered Sep 19 '22 06:09

cagdas basaraner