Skip to content

Commit

Permalink
Add flag to setChoices on if to reset the search flag (default true)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xon committed Sep 4, 2024
1 parent 7618d63 commit 09e0a97
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/scripts/choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,9 @@ class Choices {
| (InputChoice | InputGroup)[]
| ((instance: Choices) => (InputChoice | InputGroup)[] | Promise<(InputChoice | InputGroup)[]>) = [],
value: string | null = 'value',
label = 'label',
replaceChoices = false,
label: string = 'label',
replaceChoices: boolean = false,
clearSearchFlag: boolean = true,
): this | Promise<this> {
if (!this.initialisedOK) {
this._warnChoicesInitFailed('setChoices');
Expand Down Expand Up @@ -724,6 +725,9 @@ class Choices {
this.containerOuter.removeLoadingState();

this._store.withTxn(() => {
if (clearSearchFlag) {
this._isSearching = false;
}
const isDefaultValue = value === 'value';
const isDefaultLabel = label === 'label';

Expand Down

0 comments on commit 09e0a97

Please sign in to comment.