How to override js file of base folder in Magento_Ui? The 2019 Stack Overflow Developer Survey Results Are InExtending / Overriding JS in Magento 2Magento 2.2 override extension fileHow to add sales.js in this xml file in Magent2?Overriding core layout XML located in “base” not in “frontend”Magento 2 : override phtml file issueHow to override vendor theme in app/design folder magento 2?Override Admin theme template fileHow to get the selected Order(s) so i can use them for building a form in custom grid?Change Magento 2 Paypal Logo on Checkout Step 2Magento2.2.x how to set admin Filter functionality on custom page on frontend grid?How to remove secondary UI component in Magento 2?
Does HR tell a hiring manager about salary negotiations?
Why doesn't UInt have a toDouble()?
How to translate "being like"?
Loose spokes after only a few rides
A word that means fill it to the required quantity
Worn-tile Scrabble
How do you keep chess fun when your opponent constantly beats you?
What do hard-Brexiteers want with respect to the Irish border?
Are spiders unable to hurt humans, especially very small spiders?
What information about me do stores get via my credit card?
Mathematics of imaging the black hole
I am an eight letter word. What am I?
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
Inverse Relationship Between Precision and Recall
How to support a colleague who finds meetings extremely tiring?
How to charge AirPods to keep battery healthy?
What is the most efficient way to store a numeric range?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Ubuntu Server install with full GUI
What is the motivation for a law requiring 2 parties to consent for recording a conversation
What do I do when my TA workload is more than expected?
Time travel alters history but people keep saying nothing's changed
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
How do I free up internal storage if I don't have any apps downloaded?
How to override js file of base folder in Magento_Ui?
The 2019 Stack Overflow Developer Survey Results Are InExtending / Overriding JS in Magento 2Magento 2.2 override extension fileHow to add sales.js in this xml file in Magent2?Overriding core layout XML located in “base” not in “frontend”Magento 2 : override phtml file issueHow to override vendor theme in app/design folder magento 2?Override Admin theme template fileHow to get the selected Order(s) so i can use them for building a form in custom grid?Change Magento 2 Paypal Logo on Checkout Step 2Magento2.2.x how to set admin Filter functionality on custom page on frontend grid?How to remove secondary UI component in Magento 2?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to override the sizes.js in location:
/vendor/magento/module-ui/view/base/web/js/grid/paging/sizes.js
I want to remove "Custom" and "200" options from admin grid per page dropdown.
magento2.2
New contributor
add a comment |
I want to override the sizes.js in location:
/vendor/magento/module-ui/view/base/web/js/grid/paging/sizes.js
I want to remove "Custom" and "200" options from admin grid per page dropdown.
magento2.2
New contributor
add a comment |
I want to override the sizes.js in location:
/vendor/magento/module-ui/view/base/web/js/grid/paging/sizes.js
I want to remove "Custom" and "200" options from admin grid per page dropdown.
magento2.2
New contributor
I want to override the sizes.js in location:
/vendor/magento/module-ui/view/base/web/js/grid/paging/sizes.js
I want to remove "Custom" and "200" options from admin grid per page dropdown.
magento2.2
magento2.2
New contributor
New contributor
edited Apr 8 at 13:30
Biren Patel
New contributor
asked Apr 8 at 12:49
Biren PatelBiren Patel
33
33
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try following solution.
[Vendor]/[Module/view/base/requirejs-config.js
var config =
map:
'*':
'Magento_Ui/js/grid/paging/sizes':'[Vendor]_[Module]/js/grid/paging/sizes'
;
[Vendor]/[Module/view/base/web/js/grid/paging/sizes.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'ko',
'underscore',
'mageUtils',
'uiElement'
], function (ko, _, utils, Element)
'use strict';
return Element.extend(
defaults:
template: '[Vendor]_[Module]/grid/paging/sizes',
value: 20,
minSize: 1,
maxSize: 999,
options:
'20':
value: 20,
label: 20
,
'30':
value: 30,
label: 30
,
'50':
value: 50,
label: 50
,
'100':
value: 100,
label: 100
,
'200':
value: 200,
label: 200
,
statefull:
options: true,
value: true
,
listens:
value: 'onValueChange',
options: 'onSizesChange'
,
/**
* Initializes sizes component.
*
* @returns Sizes Chainable.
*/
initialize: function ()
this._super()
.updateArray();
this.removeSize(200)
.discardCustom();
return this;
,
/**
* Initializes observable properties.
*
* @returns Sizes Chainable.
*/
initObservable: function ()
this._super()
.track([
'value',
'editing',
'customVisible',
'customValue'
])
.track(
optionsArray: []
);
this._value = ko.pureComputed(
read: ko.getObservable(this, 'value'),
/**
* Validates input field prior to updating 'value' property.
*/
write: function (value)
value = this.normalize(value);
this.value = value;
this._value.notifySubscribers(value);
,
owner: this
);
return this;
,
/**
* Starts editing of the specified size.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
edit: function (value)
this.editing = value;
return this;
,
/**
* Discards changes made to the currently editable size.
*
* @returns Sizes Chainable.
*/
discardEditing: function ()
var value = this.editing;
if (value)
this.updateSize(value, value);
return this;
,
/**
* Invokes 'discardEditing' and 'discardCustom' actions.
*
* @returns Sizes Chainable.
*/
discardAll: function ()
this.discardEditing()
.discardCustom();
return this;
,
/**
* Returns value of the first size.
*
* @returns Number
*/
getFirst: function ()
return this.optionsArray[0].value;
,
/**
* Returns size which matches specified value.
*
* @param Number value - Value of the item.
* @returns Undefined
*/
getSize: function (value)
return this.options[value];
,
/**
* Sets current size to the specified value.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
setSize: function (value)
this.value = value;
return this;
,
/**
* Adds a new value to sizes list.
*
* @param Number value - Value to be added.
* @returns Sizes Chainable.
*/
addSize: function (value)
var size;
if (!this.hasSize(value))
size = this.createSize(value);
this.set('options.' + value, size);
return this;
,
/**
* Removes provided value from the sizes list.
*
* @param Number value - Value to be removed.
* @returns Sizes Chainable.
*/
removeSize: function (value)
if (!this.hasSize(value))
return this;
this.remove('options.' + value);
if (this.isSelected(value))
this.setSize(this.getFirst());
return this;
,
/**
* Updates existing value to the provided one. If new value
* is not specified, then sizes' '_value' property will be taken.
*
* @param Number value - Existing value that should be updated.
* @param (Number [newValue=size._value] - New size value.
* @returns Sizes Chainable.
*/
updateSize: function (value, newValue) ,
/**
* Creates new editable size instance with the provided value.
*
* @param Number value - Value of the size.
* @returns Object
*/
createSize: function (value)
return
value: value,
label: value,
_value: value,
editable: true
;
,
/**
* Checks if provided value exists in the sizes list.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
hasSize: function (value)
return !!this.getSize(value);
,
/**
* Hides and clears custom field.
*
* @returns Sizes Chainable.
*/
discardCustom: function ()
this.hideCustom()
.clearCustom();
return this;
,
/**
* Shows custom field.
*
* @returns Sizes Chainable.
*/
showCustom: function ()
this.customVisible = true;
return this;
,
/**
* Hides custom field.
*
* @returns Sizes Chainable.
*/
hideCustom: function ()
this.customVisible = false;
return this;
,
/**
* Empties value of the custom field.
*
* @returns Sizes Chainable.
*/
clearCustom: function ()
this.customValue = '';
return this;
,
/**
* Adds a new size specified in the custom field.
*
* @returns Sizes Chainable.
*/
applyCustom: function ()
var value = this.customValue;
value = this.normalize(value);
this.addSize(value)
.setSize(value)
.discardCustom();
return this;
,
/**
* Checks if custom field is visible.
*
* @returns Boolean
*/
isCustomVisible: function ()
return this.customVisible;
,
/**
* Converts provided value to a number and puts
* it in range between 'minSize' and 'maxSize' properties.
*
* @param (Number value - Value to be normalized.
* @returns Number
*/
normalize: function (value)
value = +value;
if (isNaN(value))
return this.getFirst();
return utils.inRange(Math.round(value), this.minSize, this.maxSize);
,
/**
* Updates the array of options.
*
* @returns Sizes Chainable.
*/
updateArray: function ()
var array = _.values(this.options);
this.optionsArray = _.sortBy(array, 'value');
return this;
,
/**
* Checks if provided value is in editing state.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isEditing: function (value)
return this.editing === value;
,
/**
* Checks if provided value is selected.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isSelected: function (value)
return this.value === value;
,
/**
* Listener of the 'value' property changes.
*/
onValueChange: function ()
this.discardAll()
.trigger('close');
,
/**
* Listener of the 'options' object changes.
*/
onSizesChange: function ()
this.editing = false;
this.updateArray();
);
);
Here only 2 changes are there. template parameter and initialize function. Replace your module name in template parameter.
[Vendor]/[Module]/view/base/web/template/grid/paging/sizes.html
<div class="selectmenu" collapsible="">
<div class="selectmenu-value" openCollapsible="">
<input type="text" ko-value="_value" attr="id: index" autoselect/>
</div>
<button class="selectmenu-toggle" type="button" css="_active: $collapsible.opened" toggleCollapsible>
<span translate="'Select'"/>
</button>
<div class="selectmenu-items" css="_active: $collapsible.opened" outerClick="discardAll.bind($data)">
<ul>
<li repeat="foreach: optionsArray, item: '$size'" css="_edit: isEditing($size().value)">
<div class="selectmenu-item-edit" if="$size().editable" keyboard="13: updateSize.bind($data, $size().value, false)">
<input class="admin__control-text" type="text"
ko-value="$size()._value" hasFocus="isEditing($size().value)"/>
<button class="action-save" type="button" click="updateSize.bind($data, $size().value, false)">
<span translate="'Save'"/>
</button>
<button class="action-delete" type="button" click="removeSize.bind($data, $size().value, false)">
<span translate="'Delete'"/>
</button>
</div>
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button" text="$size().label" click="setSize.bind($data, $size().value)"/>
<button class="action-edit" type="button" if="$size().editable"
data-bind="
click: function ()
discardCustom().edit($size().value);
">
<span translate="'Edit'"/>
</button>
</div>
</li>
<li css="_edit: isCustomVisible()" data-bind="visible: isCustomVisible()">
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button"
translate="'Custom'"
ko-visible="!isCustomVisible()"
data-bind="
click: function ()
$data.showCustom()
.discardEditing();
"/>
</div>
<div class="selectmenu-item-edit" keyboard="13: applyCustom">
<input class="admin__control-text" type="text" ko-value="customValue" hasFocus="isCustomVisible()"/>
<button class="action-save" type="button" click="applyCustom">
<span translate="'Save'"/>
</button>
</div>
</li>
</ul>
</div>
</div>
<label class="admin__control-support-text" translate="'per page'" attr="for: index"/>
Here i have added data-bind in second li.
After making the changes, execute folllogin commands.
rm -rf var/view_preprocessed/*
rm -rf pub/static/adminhtml/*
php bin/magento setup:static-content:deploy -f
truncate ui_bookmarks table in mysql
It should work.
Thank you Yash, It's working fine
– Biren Patel
yesterday
add a comment |
In your custom module [Namespace]/[Module]/view/frontend/requirejs-config.js add this
var config =
map:
'*':
'Magento_Ui/Magento_Ui/js/view/messages.js':'[Namespace]_[Module]/js/view/messages.js'
;
your overridden js file should be here
[Namespace]_[Module]/view/frontend/web/js/view/messages.js
php bin/magento setup:upgrade
&& php bin/magento setup:static-content:deploy -f
read more here: Extending / Overriding JS in Magento 2
Tried your solution But unable to remove "Custom" and "200" options from admin grid
– Biren Patel
Apr 8 at 13:31
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Biren Patel is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269182%2fhow-to-override-js-file-of-base-folder-in-magento-ui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try following solution.
[Vendor]/[Module/view/base/requirejs-config.js
var config =
map:
'*':
'Magento_Ui/js/grid/paging/sizes':'[Vendor]_[Module]/js/grid/paging/sizes'
;
[Vendor]/[Module/view/base/web/js/grid/paging/sizes.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'ko',
'underscore',
'mageUtils',
'uiElement'
], function (ko, _, utils, Element)
'use strict';
return Element.extend(
defaults:
template: '[Vendor]_[Module]/grid/paging/sizes',
value: 20,
minSize: 1,
maxSize: 999,
options:
'20':
value: 20,
label: 20
,
'30':
value: 30,
label: 30
,
'50':
value: 50,
label: 50
,
'100':
value: 100,
label: 100
,
'200':
value: 200,
label: 200
,
statefull:
options: true,
value: true
,
listens:
value: 'onValueChange',
options: 'onSizesChange'
,
/**
* Initializes sizes component.
*
* @returns Sizes Chainable.
*/
initialize: function ()
this._super()
.updateArray();
this.removeSize(200)
.discardCustom();
return this;
,
/**
* Initializes observable properties.
*
* @returns Sizes Chainable.
*/
initObservable: function ()
this._super()
.track([
'value',
'editing',
'customVisible',
'customValue'
])
.track(
optionsArray: []
);
this._value = ko.pureComputed(
read: ko.getObservable(this, 'value'),
/**
* Validates input field prior to updating 'value' property.
*/
write: function (value)
value = this.normalize(value);
this.value = value;
this._value.notifySubscribers(value);
,
owner: this
);
return this;
,
/**
* Starts editing of the specified size.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
edit: function (value)
this.editing = value;
return this;
,
/**
* Discards changes made to the currently editable size.
*
* @returns Sizes Chainable.
*/
discardEditing: function ()
var value = this.editing;
if (value)
this.updateSize(value, value);
return this;
,
/**
* Invokes 'discardEditing' and 'discardCustom' actions.
*
* @returns Sizes Chainable.
*/
discardAll: function ()
this.discardEditing()
.discardCustom();
return this;
,
/**
* Returns value of the first size.
*
* @returns Number
*/
getFirst: function ()
return this.optionsArray[0].value;
,
/**
* Returns size which matches specified value.
*
* @param Number value - Value of the item.
* @returns Undefined
*/
getSize: function (value)
return this.options[value];
,
/**
* Sets current size to the specified value.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
setSize: function (value)
this.value = value;
return this;
,
/**
* Adds a new value to sizes list.
*
* @param Number value - Value to be added.
* @returns Sizes Chainable.
*/
addSize: function (value)
var size;
if (!this.hasSize(value))
size = this.createSize(value);
this.set('options.' + value, size);
return this;
,
/**
* Removes provided value from the sizes list.
*
* @param Number value - Value to be removed.
* @returns Sizes Chainable.
*/
removeSize: function (value)
if (!this.hasSize(value))
return this;
this.remove('options.' + value);
if (this.isSelected(value))
this.setSize(this.getFirst());
return this;
,
/**
* Updates existing value to the provided one. If new value
* is not specified, then sizes' '_value' property will be taken.
*
* @param Number value - Existing value that should be updated.
* @param (Number [newValue=size._value] - New size value.
* @returns Sizes Chainable.
*/
updateSize: function (value, newValue) ,
/**
* Creates new editable size instance with the provided value.
*
* @param Number value - Value of the size.
* @returns Object
*/
createSize: function (value)
return
value: value,
label: value,
_value: value,
editable: true
;
,
/**
* Checks if provided value exists in the sizes list.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
hasSize: function (value)
return !!this.getSize(value);
,
/**
* Hides and clears custom field.
*
* @returns Sizes Chainable.
*/
discardCustom: function ()
this.hideCustom()
.clearCustom();
return this;
,
/**
* Shows custom field.
*
* @returns Sizes Chainable.
*/
showCustom: function ()
this.customVisible = true;
return this;
,
/**
* Hides custom field.
*
* @returns Sizes Chainable.
*/
hideCustom: function ()
this.customVisible = false;
return this;
,
/**
* Empties value of the custom field.
*
* @returns Sizes Chainable.
*/
clearCustom: function ()
this.customValue = '';
return this;
,
/**
* Adds a new size specified in the custom field.
*
* @returns Sizes Chainable.
*/
applyCustom: function ()
var value = this.customValue;
value = this.normalize(value);
this.addSize(value)
.setSize(value)
.discardCustom();
return this;
,
/**
* Checks if custom field is visible.
*
* @returns Boolean
*/
isCustomVisible: function ()
return this.customVisible;
,
/**
* Converts provided value to a number and puts
* it in range between 'minSize' and 'maxSize' properties.
*
* @param (Number value - Value to be normalized.
* @returns Number
*/
normalize: function (value)
value = +value;
if (isNaN(value))
return this.getFirst();
return utils.inRange(Math.round(value), this.minSize, this.maxSize);
,
/**
* Updates the array of options.
*
* @returns Sizes Chainable.
*/
updateArray: function ()
var array = _.values(this.options);
this.optionsArray = _.sortBy(array, 'value');
return this;
,
/**
* Checks if provided value is in editing state.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isEditing: function (value)
return this.editing === value;
,
/**
* Checks if provided value is selected.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isSelected: function (value)
return this.value === value;
,
/**
* Listener of the 'value' property changes.
*/
onValueChange: function ()
this.discardAll()
.trigger('close');
,
/**
* Listener of the 'options' object changes.
*/
onSizesChange: function ()
this.editing = false;
this.updateArray();
);
);
Here only 2 changes are there. template parameter and initialize function. Replace your module name in template parameter.
[Vendor]/[Module]/view/base/web/template/grid/paging/sizes.html
<div class="selectmenu" collapsible="">
<div class="selectmenu-value" openCollapsible="">
<input type="text" ko-value="_value" attr="id: index" autoselect/>
</div>
<button class="selectmenu-toggle" type="button" css="_active: $collapsible.opened" toggleCollapsible>
<span translate="'Select'"/>
</button>
<div class="selectmenu-items" css="_active: $collapsible.opened" outerClick="discardAll.bind($data)">
<ul>
<li repeat="foreach: optionsArray, item: '$size'" css="_edit: isEditing($size().value)">
<div class="selectmenu-item-edit" if="$size().editable" keyboard="13: updateSize.bind($data, $size().value, false)">
<input class="admin__control-text" type="text"
ko-value="$size()._value" hasFocus="isEditing($size().value)"/>
<button class="action-save" type="button" click="updateSize.bind($data, $size().value, false)">
<span translate="'Save'"/>
</button>
<button class="action-delete" type="button" click="removeSize.bind($data, $size().value, false)">
<span translate="'Delete'"/>
</button>
</div>
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button" text="$size().label" click="setSize.bind($data, $size().value)"/>
<button class="action-edit" type="button" if="$size().editable"
data-bind="
click: function ()
discardCustom().edit($size().value);
">
<span translate="'Edit'"/>
</button>
</div>
</li>
<li css="_edit: isCustomVisible()" data-bind="visible: isCustomVisible()">
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button"
translate="'Custom'"
ko-visible="!isCustomVisible()"
data-bind="
click: function ()
$data.showCustom()
.discardEditing();
"/>
</div>
<div class="selectmenu-item-edit" keyboard="13: applyCustom">
<input class="admin__control-text" type="text" ko-value="customValue" hasFocus="isCustomVisible()"/>
<button class="action-save" type="button" click="applyCustom">
<span translate="'Save'"/>
</button>
</div>
</li>
</ul>
</div>
</div>
<label class="admin__control-support-text" translate="'per page'" attr="for: index"/>
Here i have added data-bind in second li.
After making the changes, execute folllogin commands.
rm -rf var/view_preprocessed/*
rm -rf pub/static/adminhtml/*
php bin/magento setup:static-content:deploy -f
truncate ui_bookmarks table in mysql
It should work.
Thank you Yash, It's working fine
– Biren Patel
yesterday
add a comment |
Try following solution.
[Vendor]/[Module/view/base/requirejs-config.js
var config =
map:
'*':
'Magento_Ui/js/grid/paging/sizes':'[Vendor]_[Module]/js/grid/paging/sizes'
;
[Vendor]/[Module/view/base/web/js/grid/paging/sizes.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'ko',
'underscore',
'mageUtils',
'uiElement'
], function (ko, _, utils, Element)
'use strict';
return Element.extend(
defaults:
template: '[Vendor]_[Module]/grid/paging/sizes',
value: 20,
minSize: 1,
maxSize: 999,
options:
'20':
value: 20,
label: 20
,
'30':
value: 30,
label: 30
,
'50':
value: 50,
label: 50
,
'100':
value: 100,
label: 100
,
'200':
value: 200,
label: 200
,
statefull:
options: true,
value: true
,
listens:
value: 'onValueChange',
options: 'onSizesChange'
,
/**
* Initializes sizes component.
*
* @returns Sizes Chainable.
*/
initialize: function ()
this._super()
.updateArray();
this.removeSize(200)
.discardCustom();
return this;
,
/**
* Initializes observable properties.
*
* @returns Sizes Chainable.
*/
initObservable: function ()
this._super()
.track([
'value',
'editing',
'customVisible',
'customValue'
])
.track(
optionsArray: []
);
this._value = ko.pureComputed(
read: ko.getObservable(this, 'value'),
/**
* Validates input field prior to updating 'value' property.
*/
write: function (value)
value = this.normalize(value);
this.value = value;
this._value.notifySubscribers(value);
,
owner: this
);
return this;
,
/**
* Starts editing of the specified size.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
edit: function (value)
this.editing = value;
return this;
,
/**
* Discards changes made to the currently editable size.
*
* @returns Sizes Chainable.
*/
discardEditing: function ()
var value = this.editing;
if (value)
this.updateSize(value, value);
return this;
,
/**
* Invokes 'discardEditing' and 'discardCustom' actions.
*
* @returns Sizes Chainable.
*/
discardAll: function ()
this.discardEditing()
.discardCustom();
return this;
,
/**
* Returns value of the first size.
*
* @returns Number
*/
getFirst: function ()
return this.optionsArray[0].value;
,
/**
* Returns size which matches specified value.
*
* @param Number value - Value of the item.
* @returns Undefined
*/
getSize: function (value)
return this.options[value];
,
/**
* Sets current size to the specified value.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
setSize: function (value)
this.value = value;
return this;
,
/**
* Adds a new value to sizes list.
*
* @param Number value - Value to be added.
* @returns Sizes Chainable.
*/
addSize: function (value)
var size;
if (!this.hasSize(value))
size = this.createSize(value);
this.set('options.' + value, size);
return this;
,
/**
* Removes provided value from the sizes list.
*
* @param Number value - Value to be removed.
* @returns Sizes Chainable.
*/
removeSize: function (value)
if (!this.hasSize(value))
return this;
this.remove('options.' + value);
if (this.isSelected(value))
this.setSize(this.getFirst());
return this;
,
/**
* Updates existing value to the provided one. If new value
* is not specified, then sizes' '_value' property will be taken.
*
* @param Number value - Existing value that should be updated.
* @param (Number [newValue=size._value] - New size value.
* @returns Sizes Chainable.
*/
updateSize: function (value, newValue) ,
/**
* Creates new editable size instance with the provided value.
*
* @param Number value - Value of the size.
* @returns Object
*/
createSize: function (value)
return
value: value,
label: value,
_value: value,
editable: true
;
,
/**
* Checks if provided value exists in the sizes list.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
hasSize: function (value)
return !!this.getSize(value);
,
/**
* Hides and clears custom field.
*
* @returns Sizes Chainable.
*/
discardCustom: function ()
this.hideCustom()
.clearCustom();
return this;
,
/**
* Shows custom field.
*
* @returns Sizes Chainable.
*/
showCustom: function ()
this.customVisible = true;
return this;
,
/**
* Hides custom field.
*
* @returns Sizes Chainable.
*/
hideCustom: function ()
this.customVisible = false;
return this;
,
/**
* Empties value of the custom field.
*
* @returns Sizes Chainable.
*/
clearCustom: function ()
this.customValue = '';
return this;
,
/**
* Adds a new size specified in the custom field.
*
* @returns Sizes Chainable.
*/
applyCustom: function ()
var value = this.customValue;
value = this.normalize(value);
this.addSize(value)
.setSize(value)
.discardCustom();
return this;
,
/**
* Checks if custom field is visible.
*
* @returns Boolean
*/
isCustomVisible: function ()
return this.customVisible;
,
/**
* Converts provided value to a number and puts
* it in range between 'minSize' and 'maxSize' properties.
*
* @param (Number value - Value to be normalized.
* @returns Number
*/
normalize: function (value)
value = +value;
if (isNaN(value))
return this.getFirst();
return utils.inRange(Math.round(value), this.minSize, this.maxSize);
,
/**
* Updates the array of options.
*
* @returns Sizes Chainable.
*/
updateArray: function ()
var array = _.values(this.options);
this.optionsArray = _.sortBy(array, 'value');
return this;
,
/**
* Checks if provided value is in editing state.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isEditing: function (value)
return this.editing === value;
,
/**
* Checks if provided value is selected.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isSelected: function (value)
return this.value === value;
,
/**
* Listener of the 'value' property changes.
*/
onValueChange: function ()
this.discardAll()
.trigger('close');
,
/**
* Listener of the 'options' object changes.
*/
onSizesChange: function ()
this.editing = false;
this.updateArray();
);
);
Here only 2 changes are there. template parameter and initialize function. Replace your module name in template parameter.
[Vendor]/[Module]/view/base/web/template/grid/paging/sizes.html
<div class="selectmenu" collapsible="">
<div class="selectmenu-value" openCollapsible="">
<input type="text" ko-value="_value" attr="id: index" autoselect/>
</div>
<button class="selectmenu-toggle" type="button" css="_active: $collapsible.opened" toggleCollapsible>
<span translate="'Select'"/>
</button>
<div class="selectmenu-items" css="_active: $collapsible.opened" outerClick="discardAll.bind($data)">
<ul>
<li repeat="foreach: optionsArray, item: '$size'" css="_edit: isEditing($size().value)">
<div class="selectmenu-item-edit" if="$size().editable" keyboard="13: updateSize.bind($data, $size().value, false)">
<input class="admin__control-text" type="text"
ko-value="$size()._value" hasFocus="isEditing($size().value)"/>
<button class="action-save" type="button" click="updateSize.bind($data, $size().value, false)">
<span translate="'Save'"/>
</button>
<button class="action-delete" type="button" click="removeSize.bind($data, $size().value, false)">
<span translate="'Delete'"/>
</button>
</div>
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button" text="$size().label" click="setSize.bind($data, $size().value)"/>
<button class="action-edit" type="button" if="$size().editable"
data-bind="
click: function ()
discardCustom().edit($size().value);
">
<span translate="'Edit'"/>
</button>
</div>
</li>
<li css="_edit: isCustomVisible()" data-bind="visible: isCustomVisible()">
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button"
translate="'Custom'"
ko-visible="!isCustomVisible()"
data-bind="
click: function ()
$data.showCustom()
.discardEditing();
"/>
</div>
<div class="selectmenu-item-edit" keyboard="13: applyCustom">
<input class="admin__control-text" type="text" ko-value="customValue" hasFocus="isCustomVisible()"/>
<button class="action-save" type="button" click="applyCustom">
<span translate="'Save'"/>
</button>
</div>
</li>
</ul>
</div>
</div>
<label class="admin__control-support-text" translate="'per page'" attr="for: index"/>
Here i have added data-bind in second li.
After making the changes, execute folllogin commands.
rm -rf var/view_preprocessed/*
rm -rf pub/static/adminhtml/*
php bin/magento setup:static-content:deploy -f
truncate ui_bookmarks table in mysql
It should work.
Thank you Yash, It's working fine
– Biren Patel
yesterday
add a comment |
Try following solution.
[Vendor]/[Module/view/base/requirejs-config.js
var config =
map:
'*':
'Magento_Ui/js/grid/paging/sizes':'[Vendor]_[Module]/js/grid/paging/sizes'
;
[Vendor]/[Module/view/base/web/js/grid/paging/sizes.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'ko',
'underscore',
'mageUtils',
'uiElement'
], function (ko, _, utils, Element)
'use strict';
return Element.extend(
defaults:
template: '[Vendor]_[Module]/grid/paging/sizes',
value: 20,
minSize: 1,
maxSize: 999,
options:
'20':
value: 20,
label: 20
,
'30':
value: 30,
label: 30
,
'50':
value: 50,
label: 50
,
'100':
value: 100,
label: 100
,
'200':
value: 200,
label: 200
,
statefull:
options: true,
value: true
,
listens:
value: 'onValueChange',
options: 'onSizesChange'
,
/**
* Initializes sizes component.
*
* @returns Sizes Chainable.
*/
initialize: function ()
this._super()
.updateArray();
this.removeSize(200)
.discardCustom();
return this;
,
/**
* Initializes observable properties.
*
* @returns Sizes Chainable.
*/
initObservable: function ()
this._super()
.track([
'value',
'editing',
'customVisible',
'customValue'
])
.track(
optionsArray: []
);
this._value = ko.pureComputed(
read: ko.getObservable(this, 'value'),
/**
* Validates input field prior to updating 'value' property.
*/
write: function (value)
value = this.normalize(value);
this.value = value;
this._value.notifySubscribers(value);
,
owner: this
);
return this;
,
/**
* Starts editing of the specified size.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
edit: function (value)
this.editing = value;
return this;
,
/**
* Discards changes made to the currently editable size.
*
* @returns Sizes Chainable.
*/
discardEditing: function ()
var value = this.editing;
if (value)
this.updateSize(value, value);
return this;
,
/**
* Invokes 'discardEditing' and 'discardCustom' actions.
*
* @returns Sizes Chainable.
*/
discardAll: function ()
this.discardEditing()
.discardCustom();
return this;
,
/**
* Returns value of the first size.
*
* @returns Number
*/
getFirst: function ()
return this.optionsArray[0].value;
,
/**
* Returns size which matches specified value.
*
* @param Number value - Value of the item.
* @returns Undefined
*/
getSize: function (value)
return this.options[value];
,
/**
* Sets current size to the specified value.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
setSize: function (value)
this.value = value;
return this;
,
/**
* Adds a new value to sizes list.
*
* @param Number value - Value to be added.
* @returns Sizes Chainable.
*/
addSize: function (value)
var size;
if (!this.hasSize(value))
size = this.createSize(value);
this.set('options.' + value, size);
return this;
,
/**
* Removes provided value from the sizes list.
*
* @param Number value - Value to be removed.
* @returns Sizes Chainable.
*/
removeSize: function (value)
if (!this.hasSize(value))
return this;
this.remove('options.' + value);
if (this.isSelected(value))
this.setSize(this.getFirst());
return this;
,
/**
* Updates existing value to the provided one. If new value
* is not specified, then sizes' '_value' property will be taken.
*
* @param Number value - Existing value that should be updated.
* @param (Number [newValue=size._value] - New size value.
* @returns Sizes Chainable.
*/
updateSize: function (value, newValue) ,
/**
* Creates new editable size instance with the provided value.
*
* @param Number value - Value of the size.
* @returns Object
*/
createSize: function (value)
return
value: value,
label: value,
_value: value,
editable: true
;
,
/**
* Checks if provided value exists in the sizes list.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
hasSize: function (value)
return !!this.getSize(value);
,
/**
* Hides and clears custom field.
*
* @returns Sizes Chainable.
*/
discardCustom: function ()
this.hideCustom()
.clearCustom();
return this;
,
/**
* Shows custom field.
*
* @returns Sizes Chainable.
*/
showCustom: function ()
this.customVisible = true;
return this;
,
/**
* Hides custom field.
*
* @returns Sizes Chainable.
*/
hideCustom: function ()
this.customVisible = false;
return this;
,
/**
* Empties value of the custom field.
*
* @returns Sizes Chainable.
*/
clearCustom: function ()
this.customValue = '';
return this;
,
/**
* Adds a new size specified in the custom field.
*
* @returns Sizes Chainable.
*/
applyCustom: function ()
var value = this.customValue;
value = this.normalize(value);
this.addSize(value)
.setSize(value)
.discardCustom();
return this;
,
/**
* Checks if custom field is visible.
*
* @returns Boolean
*/
isCustomVisible: function ()
return this.customVisible;
,
/**
* Converts provided value to a number and puts
* it in range between 'minSize' and 'maxSize' properties.
*
* @param (Number value - Value to be normalized.
* @returns Number
*/
normalize: function (value)
value = +value;
if (isNaN(value))
return this.getFirst();
return utils.inRange(Math.round(value), this.minSize, this.maxSize);
,
/**
* Updates the array of options.
*
* @returns Sizes Chainable.
*/
updateArray: function ()
var array = _.values(this.options);
this.optionsArray = _.sortBy(array, 'value');
return this;
,
/**
* Checks if provided value is in editing state.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isEditing: function (value)
return this.editing === value;
,
/**
* Checks if provided value is selected.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isSelected: function (value)
return this.value === value;
,
/**
* Listener of the 'value' property changes.
*/
onValueChange: function ()
this.discardAll()
.trigger('close');
,
/**
* Listener of the 'options' object changes.
*/
onSizesChange: function ()
this.editing = false;
this.updateArray();
);
);
Here only 2 changes are there. template parameter and initialize function. Replace your module name in template parameter.
[Vendor]/[Module]/view/base/web/template/grid/paging/sizes.html
<div class="selectmenu" collapsible="">
<div class="selectmenu-value" openCollapsible="">
<input type="text" ko-value="_value" attr="id: index" autoselect/>
</div>
<button class="selectmenu-toggle" type="button" css="_active: $collapsible.opened" toggleCollapsible>
<span translate="'Select'"/>
</button>
<div class="selectmenu-items" css="_active: $collapsible.opened" outerClick="discardAll.bind($data)">
<ul>
<li repeat="foreach: optionsArray, item: '$size'" css="_edit: isEditing($size().value)">
<div class="selectmenu-item-edit" if="$size().editable" keyboard="13: updateSize.bind($data, $size().value, false)">
<input class="admin__control-text" type="text"
ko-value="$size()._value" hasFocus="isEditing($size().value)"/>
<button class="action-save" type="button" click="updateSize.bind($data, $size().value, false)">
<span translate="'Save'"/>
</button>
<button class="action-delete" type="button" click="removeSize.bind($data, $size().value, false)">
<span translate="'Delete'"/>
</button>
</div>
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button" text="$size().label" click="setSize.bind($data, $size().value)"/>
<button class="action-edit" type="button" if="$size().editable"
data-bind="
click: function ()
discardCustom().edit($size().value);
">
<span translate="'Edit'"/>
</button>
</div>
</li>
<li css="_edit: isCustomVisible()" data-bind="visible: isCustomVisible()">
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button"
translate="'Custom'"
ko-visible="!isCustomVisible()"
data-bind="
click: function ()
$data.showCustom()
.discardEditing();
"/>
</div>
<div class="selectmenu-item-edit" keyboard="13: applyCustom">
<input class="admin__control-text" type="text" ko-value="customValue" hasFocus="isCustomVisible()"/>
<button class="action-save" type="button" click="applyCustom">
<span translate="'Save'"/>
</button>
</div>
</li>
</ul>
</div>
</div>
<label class="admin__control-support-text" translate="'per page'" attr="for: index"/>
Here i have added data-bind in second li.
After making the changes, execute folllogin commands.
rm -rf var/view_preprocessed/*
rm -rf pub/static/adminhtml/*
php bin/magento setup:static-content:deploy -f
truncate ui_bookmarks table in mysql
It should work.
Try following solution.
[Vendor]/[Module/view/base/requirejs-config.js
var config =
map:
'*':
'Magento_Ui/js/grid/paging/sizes':'[Vendor]_[Module]/js/grid/paging/sizes'
;
[Vendor]/[Module/view/base/web/js/grid/paging/sizes.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'ko',
'underscore',
'mageUtils',
'uiElement'
], function (ko, _, utils, Element)
'use strict';
return Element.extend(
defaults:
template: '[Vendor]_[Module]/grid/paging/sizes',
value: 20,
minSize: 1,
maxSize: 999,
options:
'20':
value: 20,
label: 20
,
'30':
value: 30,
label: 30
,
'50':
value: 50,
label: 50
,
'100':
value: 100,
label: 100
,
'200':
value: 200,
label: 200
,
statefull:
options: true,
value: true
,
listens:
value: 'onValueChange',
options: 'onSizesChange'
,
/**
* Initializes sizes component.
*
* @returns Sizes Chainable.
*/
initialize: function ()
this._super()
.updateArray();
this.removeSize(200)
.discardCustom();
return this;
,
/**
* Initializes observable properties.
*
* @returns Sizes Chainable.
*/
initObservable: function ()
this._super()
.track([
'value',
'editing',
'customVisible',
'customValue'
])
.track(
optionsArray: []
);
this._value = ko.pureComputed(
read: ko.getObservable(this, 'value'),
/**
* Validates input field prior to updating 'value' property.
*/
write: function (value)
value = this.normalize(value);
this.value = value;
this._value.notifySubscribers(value);
,
owner: this
);
return this;
,
/**
* Starts editing of the specified size.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
edit: function (value)
this.editing = value;
return this;
,
/**
* Discards changes made to the currently editable size.
*
* @returns Sizes Chainable.
*/
discardEditing: function ()
var value = this.editing;
if (value)
this.updateSize(value, value);
return this;
,
/**
* Invokes 'discardEditing' and 'discardCustom' actions.
*
* @returns Sizes Chainable.
*/
discardAll: function ()
this.discardEditing()
.discardCustom();
return this;
,
/**
* Returns value of the first size.
*
* @returns Number
*/
getFirst: function ()
return this.optionsArray[0].value;
,
/**
* Returns size which matches specified value.
*
* @param Number value - Value of the item.
* @returns Undefined
*/
getSize: function (value)
return this.options[value];
,
/**
* Sets current size to the specified value.
*
* @param Number value - Value of the size.
* @returns Sizes Chainable.
*/
setSize: function (value)
this.value = value;
return this;
,
/**
* Adds a new value to sizes list.
*
* @param Number value - Value to be added.
* @returns Sizes Chainable.
*/
addSize: function (value)
var size;
if (!this.hasSize(value))
size = this.createSize(value);
this.set('options.' + value, size);
return this;
,
/**
* Removes provided value from the sizes list.
*
* @param Number value - Value to be removed.
* @returns Sizes Chainable.
*/
removeSize: function (value)
if (!this.hasSize(value))
return this;
this.remove('options.' + value);
if (this.isSelected(value))
this.setSize(this.getFirst());
return this;
,
/**
* Updates existing value to the provided one. If new value
* is not specified, then sizes' '_value' property will be taken.
*
* @param Number value - Existing value that should be updated.
* @param (Number [newValue=size._value] - New size value.
* @returns Sizes Chainable.
*/
updateSize: function (value, newValue) ,
/**
* Creates new editable size instance with the provided value.
*
* @param Number value - Value of the size.
* @returns Object
*/
createSize: function (value)
return
value: value,
label: value,
_value: value,
editable: true
;
,
/**
* Checks if provided value exists in the sizes list.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
hasSize: function (value)
return !!this.getSize(value);
,
/**
* Hides and clears custom field.
*
* @returns Sizes Chainable.
*/
discardCustom: function ()
this.hideCustom()
.clearCustom();
return this;
,
/**
* Shows custom field.
*
* @returns Sizes Chainable.
*/
showCustom: function ()
this.customVisible = true;
return this;
,
/**
* Hides custom field.
*
* @returns Sizes Chainable.
*/
hideCustom: function ()
this.customVisible = false;
return this;
,
/**
* Empties value of the custom field.
*
* @returns Sizes Chainable.
*/
clearCustom: function ()
this.customValue = '';
return this;
,
/**
* Adds a new size specified in the custom field.
*
* @returns Sizes Chainable.
*/
applyCustom: function ()
var value = this.customValue;
value = this.normalize(value);
this.addSize(value)
.setSize(value)
.discardCustom();
return this;
,
/**
* Checks if custom field is visible.
*
* @returns Boolean
*/
isCustomVisible: function ()
return this.customVisible;
,
/**
* Converts provided value to a number and puts
* it in range between 'minSize' and 'maxSize' properties.
*
* @param (Number value - Value to be normalized.
* @returns Number
*/
normalize: function (value)
value = +value;
if (isNaN(value))
return this.getFirst();
return utils.inRange(Math.round(value), this.minSize, this.maxSize);
,
/**
* Updates the array of options.
*
* @returns Sizes Chainable.
*/
updateArray: function ()
var array = _.values(this.options);
this.optionsArray = _.sortBy(array, 'value');
return this;
,
/**
* Checks if provided value is in editing state.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isEditing: function (value)
return this.editing === value;
,
/**
* Checks if provided value is selected.
*
* @param Number value - Value to be checked.
* @returns Boolean
*/
isSelected: function (value)
return this.value === value;
,
/**
* Listener of the 'value' property changes.
*/
onValueChange: function ()
this.discardAll()
.trigger('close');
,
/**
* Listener of the 'options' object changes.
*/
onSizesChange: function ()
this.editing = false;
this.updateArray();
);
);
Here only 2 changes are there. template parameter and initialize function. Replace your module name in template parameter.
[Vendor]/[Module]/view/base/web/template/grid/paging/sizes.html
<div class="selectmenu" collapsible="">
<div class="selectmenu-value" openCollapsible="">
<input type="text" ko-value="_value" attr="id: index" autoselect/>
</div>
<button class="selectmenu-toggle" type="button" css="_active: $collapsible.opened" toggleCollapsible>
<span translate="'Select'"/>
</button>
<div class="selectmenu-items" css="_active: $collapsible.opened" outerClick="discardAll.bind($data)">
<ul>
<li repeat="foreach: optionsArray, item: '$size'" css="_edit: isEditing($size().value)">
<div class="selectmenu-item-edit" if="$size().editable" keyboard="13: updateSize.bind($data, $size().value, false)">
<input class="admin__control-text" type="text"
ko-value="$size()._value" hasFocus="isEditing($size().value)"/>
<button class="action-save" type="button" click="updateSize.bind($data, $size().value, false)">
<span translate="'Save'"/>
</button>
<button class="action-delete" type="button" click="removeSize.bind($data, $size().value, false)">
<span translate="'Delete'"/>
</button>
</div>
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button" text="$size().label" click="setSize.bind($data, $size().value)"/>
<button class="action-edit" type="button" if="$size().editable"
data-bind="
click: function ()
discardCustom().edit($size().value);
">
<span translate="'Edit'"/>
</button>
</div>
</li>
<li css="_edit: isCustomVisible()" data-bind="visible: isCustomVisible()">
<div class="selectmenu-item">
<button class="selectmenu-item-action" type="button"
translate="'Custom'"
ko-visible="!isCustomVisible()"
data-bind="
click: function ()
$data.showCustom()
.discardEditing();
"/>
</div>
<div class="selectmenu-item-edit" keyboard="13: applyCustom">
<input class="admin__control-text" type="text" ko-value="customValue" hasFocus="isCustomVisible()"/>
<button class="action-save" type="button" click="applyCustom">
<span translate="'Save'"/>
</button>
</div>
</li>
</ul>
</div>
</div>
<label class="admin__control-support-text" translate="'per page'" attr="for: index"/>
Here i have added data-bind in second li.
After making the changes, execute folllogin commands.
rm -rf var/view_preprocessed/*
rm -rf pub/static/adminhtml/*
php bin/magento setup:static-content:deploy -f
truncate ui_bookmarks table in mysql
It should work.
edited 2 days ago
answered 2 days ago
Yash ShahYash Shah
79618
79618
Thank you Yash, It's working fine
– Biren Patel
yesterday
add a comment |
Thank you Yash, It's working fine
– Biren Patel
yesterday
Thank you Yash, It's working fine
– Biren Patel
yesterday
Thank you Yash, It's working fine
– Biren Patel
yesterday
add a comment |
In your custom module [Namespace]/[Module]/view/frontend/requirejs-config.js add this
var config =
map:
'*':
'Magento_Ui/Magento_Ui/js/view/messages.js':'[Namespace]_[Module]/js/view/messages.js'
;
your overridden js file should be here
[Namespace]_[Module]/view/frontend/web/js/view/messages.js
php bin/magento setup:upgrade
&& php bin/magento setup:static-content:deploy -f
read more here: Extending / Overriding JS in Magento 2
Tried your solution But unable to remove "Custom" and "200" options from admin grid
– Biren Patel
Apr 8 at 13:31
add a comment |
In your custom module [Namespace]/[Module]/view/frontend/requirejs-config.js add this
var config =
map:
'*':
'Magento_Ui/Magento_Ui/js/view/messages.js':'[Namespace]_[Module]/js/view/messages.js'
;
your overridden js file should be here
[Namespace]_[Module]/view/frontend/web/js/view/messages.js
php bin/magento setup:upgrade
&& php bin/magento setup:static-content:deploy -f
read more here: Extending / Overriding JS in Magento 2
Tried your solution But unable to remove "Custom" and "200" options from admin grid
– Biren Patel
Apr 8 at 13:31
add a comment |
In your custom module [Namespace]/[Module]/view/frontend/requirejs-config.js add this
var config =
map:
'*':
'Magento_Ui/Magento_Ui/js/view/messages.js':'[Namespace]_[Module]/js/view/messages.js'
;
your overridden js file should be here
[Namespace]_[Module]/view/frontend/web/js/view/messages.js
php bin/magento setup:upgrade
&& php bin/magento setup:static-content:deploy -f
read more here: Extending / Overriding JS in Magento 2
In your custom module [Namespace]/[Module]/view/frontend/requirejs-config.js add this
var config =
map:
'*':
'Magento_Ui/Magento_Ui/js/view/messages.js':'[Namespace]_[Module]/js/view/messages.js'
;
your overridden js file should be here
[Namespace]_[Module]/view/frontend/web/js/view/messages.js
php bin/magento setup:upgrade
&& php bin/magento setup:static-content:deploy -f
read more here: Extending / Overriding JS in Magento 2
edited Apr 8 at 13:20
answered Apr 8 at 12:59
Savan PatelSavan Patel
668
668
Tried your solution But unable to remove "Custom" and "200" options from admin grid
– Biren Patel
Apr 8 at 13:31
add a comment |
Tried your solution But unable to remove "Custom" and "200" options from admin grid
– Biren Patel
Apr 8 at 13:31
Tried your solution But unable to remove "Custom" and "200" options from admin grid
– Biren Patel
Apr 8 at 13:31
Tried your solution But unable to remove "Custom" and "200" options from admin grid
– Biren Patel
Apr 8 at 13:31
add a comment |
Biren Patel is a new contributor. Be nice, and check out our Code of Conduct.
Biren Patel is a new contributor. Be nice, and check out our Code of Conduct.
Biren Patel is a new contributor. Be nice, and check out our Code of Conduct.
Biren Patel is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269182%2fhow-to-override-js-file-of-base-folder-in-magento-ui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown