0

I tried creating few custom options for a product. A field type and dropdown type. After saving the product getting a javascript error in the console as shown in the screenshot

data.forEach is not a function.

enter image description here

If I keep the field type option at last, then no javascript error. If it is kept as the first option, then experiencing this error.

It is a core issue and I found a solution here https://github.com/magento/magento2/issues/10321. But I want to know how to override this file using the custom module instead of changing the core file.

File Path to override: vendor\magento\module-ui\view\base\web\js\dynamic-rows\dynamic-rows-grid.js

I tried this solution with both adminhtml and base as path but it didn't work.

Create a file at below location,

Custom/Modulename/view/adminhtml/requirejs-config.js

    var config = {  
    map: {
        '*': {
            "Magento_Ui/js/dynamic-rows/dynamic-rows-grid": 'Custom_Modulename/js/dynamic-rows/dynamic-rows-grid'
        }
    }
};

create a file at location,

Custom/Modulename/view/adminhtml/web/js/dynamic-rows/dynamic-rows-grid.js

Copy content from core file to your custom file and run these commands.

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
  • Did you find any solutions? – Ranganathan Dec 1 '18 at 12:09
0

There is a similar question about extending the core javascript here. Hope it help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.