ComboBox: increase number of shown items

Hi,

is there a way to increase the number of shown items in the ComboBox component?


Details

The default value seems to be 10 items. If there are more entries in the underlying data model I have to use the arrow elements for scrolling. Now I would like to display more items at once. Do I have to modify the data model or the style?

Thanks, Thorsten

Hi,

The Select class (ComboBox inherits from) contains a protected pageLenght field, which defines the number of items per page. Unfortunately, there is no setter for this variable, so you have extend ComboBox to modify the field:

public class MyComboBox extends ComboBox {

	public MyComboBox() {
		pageLength = 20;
	}
}

-Henri

If I remember correctly, the value is hardcoded into both ComboBox and VFilterSelect classes (constants), and they should be overridable by extending the classes.

This should really be on the API level, IMO. There might be a ticket about in our Trac. At least there should be, so please create one if you feel it’s important.

Edit: blimey, Henri beat me to it :slight_smile:

Thanks for the hint. It works fine!

Thorsten

There is a setter for this field now with Vaadin 7.