Exposed filter ajax calling other entire ajax?

by Logeshvaran   Last Updated August 13, 2019 06:07 AM

I have used the below code from this URL. Run callback after Views exposed filter AJAX .

(function($, Drupal, drupalSettings) {

  Drupal.behaviors.myModuleScript = {

    attach: function(context, settings) {
      // Attach action to Drupal Ajax Views event
      $(document).once('weberAjaxViews').ajaxSuccess(function (event, data) {
        if (drupalSettings && drupalSettings.views && drupalSettings.views.ajaxViews) {

          var ajaxViews = drupalSettings.views.ajaxViews;
          Object.keys(ajaxViews || {}).forEach(function (i) {
            if (ajaxViews[i]['view_name'] == 'your_view_name' &&  ajaxViews[i]['view_display_id'] == 'your_view_display_name') {
              // Do some JS here
            }
          });

        }
      });
    }

  };

})(jQuery, Drupal, drupalSettings);

This is working fine. I am able to achieve my adding class functionality after the view result rendered.

But this WeberAjaxView default ajax call causing the other ajax also.

I want to do ajax call for this view alone. It should not disturb others ajax calls.

Please someone help me to solve this.

Tags : views 8


Related Questions


Updated February 28, 2018 21:07 PM

Updated May 26, 2016 09:03 AM

Updated July 20, 2015 13:03 PM

Updated January 12, 2017 08:03 AM

Updated May 02, 2015 23:03 PM