Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,17 @@ public ComboBoxI18n setRequiredErrorMessage(String errorMessage) {
return this;
}
}

/**
* Sets the "debounce timeout" that the component waits for a short pause in
* typing, before triggering a server-side visit to filter items. The
* default is 500ms.
*
* @param filterTimeout
* the time in milliseconds that needs to happen between
* keystrokes until filtering is triggered.
*/
public void setFilterTimeout(int filterTimeout) {
getElement().setProperty("filterDebouncerTimer", filterTimeout + "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ window.Vaadin.Flow.comboBoxConnector.initLazy = (comboBox) => {
if (filterChanged) {
cache = {};
lastFilter = params.filter;
this._filterDebouncer = Debouncer.debounce(this._filterDebouncer, timeOut.after(500), () => {
let timerValue = 500;
if (comboBox.filterDebouncerTimer) {
timerValue = comboBox.filterDebouncerTimer;
}
this._filterDebouncer = Debouncer.debounce(this._filterDebouncer, timeOut.after(timerValue), () => {
if (serverFacade.getLastFilterSentToServer() === params.filter) {
// Fixes the case when the filter changes
// to something else and back to the original value
Expand Down