ComboBox and Text Field AutoComplete from Database?

Hi

Using Vaadin 8.3.1 – How do I bind my ComboBox to an SQL Datasource and have it autocomplete as the user types in. As far as I understand it now, an entire List (Collection) will be delivered to the user (under the hood) and stored in a local session on the server. This is undesirable. I have some pretty large datasets in my database and I would like autocomplete to just return a query of (max) 10 of the clostest matches, and have it continue refinding the 10 results as the user continues to type.

Looking for a ComboBox and Text Field example of this.

I did find an autocomplete text field add-in, but hoping Vaadin 8 comes with the functionality already built-in? I’m new to 8.x, used 7.x in the past.

Thanks,
J.

With text field type inputs you need to use add-ons, there are actually more than one in Directory. In CombBox you can use lazy data provider, check section Lazy Loading Data to a Listing here:


https://vaadin.com/docs/v8/framework/datamodel/datamodel-providers.html

Similar to the above post, I am trying to use combo box for autocomplete purposes. The filter text in the combo box triggers a query to the back end database to return top 10 matching entries. This is implemented as a subclass of AbstractBackEndDataProvider. However, I noticed that each key stroke typing in the search/filter field, triggers ComboBoxServerRpc.setFilter, which subsequently triggers the AbstractBackEndDataProvider to fetch. It is undesirable for performance reasons.

  1. Text Field seems to have a way to fire value change event in lazy mode. Is there a way to fire the “filter changed” event in a similar lazy mode?
  2. Is there any way to debounce the data provider fetch calls?

Thanks,
Ching