Browse Source

HUE-4942 [metadata] Update logic of to make the search input really clearable

Romain Rigaux 9 years ago
parent
commit
ba035ab
1 changed files with 4 additions and 1 deletions
  1. 4 1
      desktop/core/src/desktop/templates/assist.mako

+ 4 - 1
desktop/core/src/desktop/templates/assist.mako

@@ -791,7 +791,10 @@ from metadata.conf import has_navigator
   <script type="text/html" id="assist-panel-navigator-search">
   <script type="text/html" id="assist-panel-navigator-search">
     <!-- ko if: navigatorEnabled -->
     <!-- ko if: navigatorEnabled -->
       <div class="searchbar">
       <div class="searchbar">
-        <input id="appendedInput" placeholder="${ _('Search everywhere...') }" type="text" data-bind="hasFocus: searchHasFocus, textinput: searchInput"><button class="btn btn-primary add-on" data-bind="enabled: !searchSubmitted(), click: function () { if (searchInput() !== '') { searchInput(''); searchHasFocus(false); } else { searchHasFocus(true); window.setTimeout(performSearch, 200); } }"><i class="fa" data-bind="css: { 'fa-search': searchInput() === '' && ! searchHasFocus(), 'fa-times' : searchInput() !== '' || searchHasFocus() }"></i></button>
+        <input id="appendedInput" placeholder="${ _('Search everywhere...') }" type="text" data-bind="hasFocus: searchHasFocus, textinput: searchInput, valueUpdate: 'afterkeydown'">
+          <button class="btn btn-primary add-on" data-bind="enabled: ! searchSubmitted(), click: function () { if (searchInput() !== '') { searchInput(''); searchHasFocus(false); } else { searchHasFocus(true); window.setTimeout(performSearch, 200); } }">
+            <i class="fa" data-bind="css: { 'fa-search': searchInput() === '', 'fa-times' : searchInput() !== '' }"></i>
+          </button>
       </div>
       </div>
     <!-- /ko -->
     <!-- /ko -->
   </script>
   </script>