The number of choices in ComboBox I’m creating is very large and it’s not advisable to load them all when the ComboBox is being created. I would rather like to send a database query only when user already enters something in the ComboBox, and populate the list of choices with query result. Is that possible with ComboBox? I thought I can populate the list after each keystroke, but I couldn’t find any way to get a server-side event after key press in the ComboBox, am I missing something?
what is the vaadin’s recommendations on such a case where a user needs to select one item from say 1-2lacs of records. Is there a choice apart from using plugins?
However, I still do not understand how I can use a lazy-loading container to populate a ComboBox based on what the user has entered in the ComboBox’s TextField.
Could someone post an example (some code, please) on how to achieve this?
An old thread and no code, but just a quick comment: one of the prerequisites for being able to do server side lazy loading in for a ComboBox is that the display format of the items must be filterable by the container - e.g. the result of a Java toString() method cannot be used for filtering in a database… Use setItemCaptionPropertyId(…) to set the correct mode and property to display and to filter on.
The container must of course be able to perform lazy loading from its data source - e.g. JPAContainer, SQLContainer and LazyQueryContainer would probably work, as would suitable custom containers.
I did not check to see if all other related limitations have been addressed so that this would do full lazy loading.