Basically I want to override grid.js component file in Magento 2
Require config
view/adminhtml/require-config.js
Require config code.
var config = {
map: {
'*': {
customScript:'Acx_Grid/js/custom'
}
}
};
I want to know process how to override J's component in backend.
Best Answer
You can change grid.js in 2 ways:
Override via
requirejs-config.js
:It will replace the grid.js file in whole Magento.
Create a file at
MyVendor/MyModule/view/adminhtml/requirejs-config.js
with the following content:For a specific grid only, you can change the phtml file which call the grid js.
vendor/magento/module-backend/view/adminhtml/templates/widget/grid/extended.phtml
into your own module atMyVendor/MyModule/view/adminhtml/template/widget/grid/extended.phtml
.256
with your own jsdeps.push('mage/adminhtml/grid');
todeps.push('MyVendor_MyModule/js/grid');