Skip to content

Commit 6cbf55d

Browse files
author
niravkrish
committed
Fixed - search icon click not working issue in admin ui grid sticky header
1 parent 75cf826 commit 6cbf55d

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

app/code/Magento/Ui/view/base/web/js/grid/search/search.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ define([
1111
'uiLayout',
1212
'mage/translate',
1313
'mageUtils',
14-
'uiElement'
15-
], function (_, layout, $t, utils, Element) {
14+
'uiElement',
15+
'jquery'
16+
], function (_, layout, $t, utils, Element, $) {
1617
'use strict';
1718

1819
return Element.extend({
@@ -29,11 +30,13 @@ define([
2930
tracks: {
3031
value: true,
3132
previews: true,
32-
inputValue: true
33+
inputValue: true,
34+
focused: true
3335
},
3436
imports: {
3537
inputValue: 'value',
36-
updatePreview: 'value'
38+
updatePreview: 'value',
39+
focused: false
3740
},
3841
exports: {
3942
value: '${ $.provider }:params.search'
@@ -88,6 +91,18 @@ define([
8891
return this;
8992
},
9093

94+
/**
95+
* Click To ScrollTop.
96+
*/
97+
scrollTo: function ($data) {
98+
$('html, body').animate({
99+
scrollTop: 0
100+
}, 'slow', function () {
101+
$data.focused = false;
102+
$data.focused = true;
103+
});
104+
},
105+
91106
/**
92107
* Resets input value to the last applied state.
93108
*

app/code/Magento/Ui/view/base/web/templates/grid/search/search.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
-->
77
<div class="data-grid-search-control-wrap">
8-
<label class="data-grid-search-label" attr="title: $t('Search'), for: index">
8+
<label class="data-grid-search-label" attr="title: $t('Search'), for: index" data-bind="click: scrollTo">
99
<span translate="'Search'"/>
1010
</label>
1111
<input class="admin__control-text data-grid-search-control" type="text"
@@ -16,6 +16,7 @@
1616
placeholder: $t(placeholder)
1717
},
1818
textInput: inputValue,
19+
hasFocus: focused,
1920
keyboard: {
2021
13: apply.bind($data, false),
2122
27: cancel

0 commit comments

Comments
 (0)