0

My goal is to include a promp widget before choosing an option value from the mass action from the product grid. Here is my code so far:

Vendor/ProductBarcode/view/base/web/requirejs-config.js :

var config = {
    mixins: {
        'Magento_Ui/js/grid/massactions' : {
            'Vendor_ProductBarcode/js/grid/massactions': true
        }
    }
};

Vendor/ProductBarcode/view/base/web/js/grid/massactions.js:

define(function () {
    'use strict';
    var mixin = {
        _init: function () {
            this._super();
        },

        applyAction: function (actionIndex) {
            var data = this.getSelections(),
                action,
                callback;

            if (!data.total) {
                alert({
                    content: this.noItemsMsg
                });

                return this;
            }
            action   = this.getAction(actionIndex);
            callback = this._getCallback(action, data);

            prompt({
                title: 'Generate & Print Labels',
                content: 'Number of copies',
                actions: {
                    confirm: function(value){
                        data.params.no_of_printing = value;
                    },
                    cancel: function(){
                        return this;
                    },
                    always: function(){
                        action.confirm ?
                            this._confirm(action, callback) :
                            callback();
                    }
                }
            });
            return this;
        }
    };

    return function (target) { 
        return target.extend(mixin); 
    };
});

My problem, is that my require js code is NOT called or NOT being triggered. Not sure why. Since I removed the cache folder, deploy static content and I running the developer mode. Also removed the browser cache. I tend to believe that is something else. Would you please advice ?

Your Answer

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

Browse other questions tagged or ask your own question.