From 686f56488c5f483ed635f452de78970a03054994 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 27 Sep 2024 09:44:53 -0600 Subject: [PATCH] ET2Textbox: Fix textbox & searchbox did not update after value was changed programmatically --- api/js/etemplate/Et2Textbox/Et2Textbox.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/api/js/etemplate/Et2Textbox/Et2Textbox.ts b/api/js/etemplate/Et2Textbox/Et2Textbox.ts index c05c5a603b..5076ad2e17 100644 --- a/api/js/etemplate/Et2Textbox/Et2Textbox.ts +++ b/api/js/etemplate/Et2Textbox/Et2Textbox.ts @@ -46,9 +46,6 @@ export class Et2Textbox extends Et2InputWidget(SlInput) ]; } - @property() - value = ""; - /** * Placeholder text to show as a hint when the input is empty. */ @@ -73,7 +70,6 @@ export class Et2Textbox extends Et2InputWidget(SlInput) private __validator : any; protected _mask : InputMask; - protected _value : string = ""; inputMode = "text"; @@ -154,6 +150,19 @@ export class Et2Textbox extends Et2InputWidget(SlInput) } } + @property() + get value() + { + return super.value; + } + + set value(newValue : string) + { + const oldValue = this.value; + super.value = newValue; + this.requestUpdate("value", oldValue); + } + /** * Get the options for masking. * Can be overridden by subclass for additional options.