From 8bbb05a596bd2e5a09f0732c6440280bb693e1d6 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 14 Aug 2020 13:35:17 +0200 Subject: [PATCH] Fix clear button in search widget disappears after being reloaded --- api/js/etemplate/et2_widget_textbox.js | 4 +++- api/js/etemplate/et2_widget_textbox.ts | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_widget_textbox.js b/api/js/etemplate/et2_widget_textbox.js index 60fbcf536e..9f8653bfcf 100644 --- a/api/js/etemplate/et2_widget_textbox.js +++ b/api/js/etemplate/et2_widget_textbox.js @@ -493,8 +493,10 @@ var et2_searchbox = /** @class */ (function (_super) { }; et2_searchbox.prototype.set_value = function (_value) { _super.prototype.set_value.call(this, _value); - if (this.search) + if (this.search) { this.search.input.val(_value); + this.clear.toggle(_value != ''); + } }; et2_searchbox.prototype.set_readonly = function (_readonly) { this.search.set_readonly(_readonly); diff --git a/api/js/etemplate/et2_widget_textbox.ts b/api/js/etemplate/et2_widget_textbox.ts index d9eec418c3..319203476f 100644 --- a/api/js/etemplate/et2_widget_textbox.ts +++ b/api/js/etemplate/et2_widget_textbox.ts @@ -584,7 +584,11 @@ class et2_searchbox extends et2_textbox set_value(_value) { super.set_value(_value); - if (this.search) this.search.input.val(_value); + if (this.search) + { + this.search.input.val(_value); + this.clear.toggle(_value != ''); + } } set_readonly(_readonly)