From b29cce05be492dc853a43ae506f3c3f9fe6143bf Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 14 Jul 2020 12:17:15 +0200 Subject: [PATCH] Fix searchbox no longer works in mobile template --- api/js/etemplate/et2_widget_textbox.js | 10 ++++++---- api/js/etemplate/et2_widget_textbox.ts | 16 +++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/api/js/etemplate/et2_widget_textbox.js b/api/js/etemplate/et2_widget_textbox.js index 2028ecf063..60fbcf536e 100644 --- a/api/js/etemplate/et2_widget_textbox.js +++ b/api/js/etemplate/et2_widget_textbox.js @@ -382,12 +382,14 @@ var et2_searchbox = /** @class */ (function (_super) { // search button indicator // no need to create search button if it's a fix search field if (!this.options.fix) { - this.button = et2_core_widget_1.et2_createWidget('button', { image: "search", "background_image": "1" }, this); - this.button.onclick = function () { + this.button = jQuery(document.createElement('button')) + .css({ "background-image": egw.image('search') }) + .click(function () { self._show_hide(jQuery(self.flex).hasClass('hide')); self.search.input.focus(); - }; - this.div.prepend(this.button.getDOMNode()); + }) + .addClass('et2_button'); + this.div.prepend(this.button); } // input field this.search = et2_core_widget_1.et2_createWidget('textbox', { "blur": egw.lang("search"), diff --git a/api/js/etemplate/et2_widget_textbox.ts b/api/js/etemplate/et2_widget_textbox.ts index 07774fa12e..d9eec418c3 100644 --- a/api/js/etemplate/et2_widget_textbox.ts +++ b/api/js/etemplate/et2_widget_textbox.ts @@ -427,7 +427,7 @@ class et2_searchbox extends et2_textbox value: string = ""; div: JQuery; flex: JQuery; - button: et2_button; + button: JQuery; search: et2_textbox; oldValue: any; clear: JQuery; @@ -457,12 +457,14 @@ class et2_searchbox extends et2_textbox // no need to create search button if it's a fix search field if (!this.options.fix) { - this.button = et2_createWidget('button',{image:"search","background_image":"1"},this); - this.button.onclick= function(){ - self._show_hide(jQuery(self.flex).hasClass('hide')); - self.search.input.focus(); - }; - this.div.prepend(this.button.getDOMNode()); + this.button = jQuery(document.createElement('button')) + .css({"background-image": egw.image('search')}) + .click(function(){ + self._show_hide(jQuery(self.flex).hasClass('hide')); + self.search.input.focus(); + }) + .addClass('et2_button'); + this.div.prepend(this.button); } // input field this.search = et2_createWidget('textbox',{"blur":egw.lang("search"),