1

I have different fields and showing in different blocks, and want to apply exposed filter to all but my problem is it shows different exposed filters for each different block. I want to make it common for each block.

Below are the steps,

  1. I made 5 blocks to be displayed for each buttons.
  2. Added exposed filter for languages for each block.

Now each block showing its different exposed filter. But I want the exposed filter should be shown above the buttons and should work for each block display. Attached screenshot for the issue.

enter image description here

I installed Views Global Filter but is gives Session error.

0

After 3 days, I haven't found the solution, even by programmatically.

Then what I had the last option(in my mind, huh) is,

  1. I get all the fields in one block only, not creating the different blocks for different tab or buttons.
  2. Used the description of Better Exposed Filters, in which I pasted my buttons/tab UI HTML as its.
  3. Now on changing the language all the fields are fetched according to the selected language. But in this case my active tab/button get lost its activeness.
  4. Now, I need to get the last active tab/buuton, so that I can click it again to get the active tab after filtering my languages.

Below is the piece of code which is need to my js file.

// Active target element to make the tab/button active after 
// ajax responds in filter
var activeTargetElement;
Drupal.behaviors.events = {
    attach: function (context, settings) {
        $('#views-exposed-form-MY_VIEW_MACHINE_NAME-BLOCK_NAME', context).ajaxStart(function () {
            // my tabs/button are active on the basis of data-target attribute,
            // so need to memorise which tab/button is active before fitering any language 
            activeTargetElement = $('#MY_TABS li.active a').data('target');
        }).ajaxSuccess(function () {
            // if any target is memorised, then simply click it or trigger a click event for it
            if($('[data-target="'+activeTargetElement+'"]').length){
                $('[data-target="'+activeTargetElement+'"]').click();
            }
        });
    }
};

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.