Skip to content

Commit

Permalink
Fixed - search icon click not working issue in admin ui grid sticky h…
Browse files Browse the repository at this point in the history
…eader
  • Loading branch information
niravkrish authored and saphaljha committed Apr 21, 2019
1 parent c52ee4a commit b3a799d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
23 changes: 19 additions & 4 deletions app/code/Magento/Ui/view/base/web/js/grid/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ define([
'uiLayout',
'mage/translate',
'mageUtils',
'uiElement'
], function (_, layout, $t, utils, Element) {
'uiElement',
'jquery'
], function (_, layout, $t, utils, Element, $) {
'use strict';

return Element.extend({
Expand All @@ -29,11 +30,13 @@ define([
tracks: {
value: true,
previews: true,
inputValue: true
inputValue: true,
focused: true
},
imports: {
inputValue: 'value',
updatePreview: 'value'
updatePreview: 'value',
focused: false
},
exports: {
value: '${ $.provider }:params.search'
Expand Down Expand Up @@ -88,6 +91,18 @@ define([
return this;
},

/**
* Click To ScrollTop.
*/
scrollTo: function ($data) {
$('html, body').animate({
scrollTop: 0
}, 'slow', function () {
$data.focused = false;
$data.focused = true;
});
},

/**
* Resets input value to the last applied state.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
-->
<div class="data-grid-search-control-wrap">
<label class="data-grid-search-label" attr="title: $t('Search'), for: index">
<label class="data-grid-search-label" attr="title: $t('Search'), for: index" data-bind="click: scrollTo">
<span translate="'Search'"/>
</label>
<input class="admin__control-text data-grid-search-control" type="text"
Expand All @@ -16,6 +16,7 @@
placeholder: $t(placeholder)
},
textInput: inputValue,
hasFocus: focused,
keyboard: {
13: apply.bind($data, false),
27: cancel
Expand Down

0 comments on commit b3a799d

Please sign in to comment.