Skip to main content
Post Closed as "Duplicate" by KAndy, CommunityBot
edited title
Link
Lachezar Raychev
  • 1.6k
  • 7
  • 26
  • 45

Magento2 rewrite javascript file from a core module in a custom module

Source Link
Lachezar Raychev
  • 1.6k
  • 7
  • 26
  • 45

Magento2 rewrite javascript file in a custom module

I have created a custom module that uses the UI component

<uiComponent name="product_listing"/>

Basically, I want to create a javascript file in my module that rewrites/overrides only the fallowing part of that component js file:

vendor/magento/module-ui/view/base/web/js/grid/provider.js:

/**
 * Reloads data with current parameters.
 */
    reload: function () {
        this.trigger('reload');

        if (this.request && this.request.readyState !== 4) {
            this.request.abort();
        }
        console.log(this);
        this.request = $.ajax({
            url: this['update_url'],
            method: 'GET',
            data: this.get('params'),
            dataType: 'json'
        });

        this.request
            .done(this.onReload)
            .error(this.onError);
    },

Can someone please guide me trough how to do that in the best and efficient way ? Thank you!