From fa7ffdf1654e1e0534db7753e6a0f6c6d6943162 Mon Sep 17 00:00:00 2001 From: Daniel Carneiro Date: Mon, 13 May 2019 15:54:20 +0100 Subject: [PATCH 1/2] added option for user to select the length of autocomplete --- .../modules/angular-slickgrid/editors/autoCompleteEditor.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts b/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts index d89780785..801857479 100644 --- a/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts +++ b/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts @@ -160,8 +160,9 @@ export class AutoCompleteEditor implements Editor { serializeValue() { // if user provided a custom structure, we will serialize the value returned from the object with custom structure + const minLength = this.editorOptions.minLength || this.editorOptions.minLength === 0 ? this.editorOptions.minLength : 3; if (this.editorOptions.forceUserInput) { - this._currentValue = this.$input.val().length > 3 ? this.$input.val() : this._currentValue; + this._currentValue = this.$input.val().length >= minLength ? this.$input.val() : this._currentValue; } if (this.customStructure && this._currentValue.hasOwnProperty(this.labelName)) { return this._currentValue[this.labelName]; From c56aa534880558944a97ca6737b367458af2f064 Mon Sep 17 00:00:00 2001 From: Daniel Carneiro Date: Mon, 13 May 2019 16:08:34 +0100 Subject: [PATCH 2/2] updated constant for better reading --- src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts b/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts index 801857479..5b68efbff 100644 --- a/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts +++ b/src/app/modules/angular-slickgrid/editors/autoCompleteEditor.ts @@ -160,7 +160,7 @@ export class AutoCompleteEditor implements Editor { serializeValue() { // if user provided a custom structure, we will serialize the value returned from the object with custom structure - const minLength = this.editorOptions.minLength || this.editorOptions.minLength === 0 ? this.editorOptions.minLength : 3; + const minLength = typeof this.editorOptions.minLength !== 'undefined' ? this.editorOptions.minLength : 3; if (this.editorOptions.forceUserInput) { this._currentValue = this.$input.val().length >= minLength ? this.$input.val() : this._currentValue; }