Search code examples
javagwtcomboboxsmartgwt

GWT Combo Box: Limiting number of entries displayed?


We are using GWT Combo box whose entries gets loaded dynamically. For eg. Ajax calls populates 30 Entries when it gets rendered.

Sample Combo Box Entries

<Select>
 <Option>Entry 1<Option>
 <Option>Entry 2<Option>
 <Option>Entry 3<Option>
  .
  .
  .
 30 Entries
</Select>

When this is rendered on UI, Can we control the number of entries show when we expand or Click on Combo Box selector. We just want to show only 5 entries at a time.


Solution

  • I believe that setPickListHeight() would do something like you want to do. The problem is that is not an entry height, it is a height in pixels so you ought to know the height of the entries you are adding. Also this height will be the height before putting on scrollbars, not sure if that is what you want.

    For further customization you might want to look at setPickListProperties() method.