mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-02 14:02:17 +02:00
Fix Issue 630: allow triggering of 'search' event when clearing the input field
This commit is contained in:
parent
781c729e13
commit
23f0b7cb9d
|
@ -1230,7 +1230,7 @@ class Choices implements Choices {
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleSearch(value: string): void {
|
_handleSearch(value: string): void {
|
||||||
if (!value || !this.input.isFocussed) {
|
if (!this.input.isFocussed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1239,7 +1239,11 @@ class Choices implements Choices {
|
||||||
const hasUnactiveChoices = choices.some((option) => !option.active);
|
const hasUnactiveChoices = choices.some((option) => !option.active);
|
||||||
|
|
||||||
// Check that we have a value to search and the input was an alphanumeric character
|
// Check that we have a value to search and the input was an alphanumeric character
|
||||||
if (value && value.length >= searchFloor) {
|
if (
|
||||||
|
value !== null &&
|
||||||
|
typeof value !== 'undefined' &&
|
||||||
|
value.length >= searchFloor
|
||||||
|
) {
|
||||||
const resultCount = searchChoices ? this._searchChoices(value) : 0;
|
const resultCount = searchChoices ? this._searchChoices(value) : 0;
|
||||||
// Trigger search event
|
// Trigger search event
|
||||||
this.passedElement.triggerEvent(EVENTS.search, {
|
this.passedElement.triggerEvent(EVENTS.search, {
|
||||||
|
|
Loading…
Reference in a new issue