Problem/Motivation

Sort of expecting no easy solution for this; but thought i'd throw it out there.

I have 3 tabs, each with their own view. The views are all ajax enabled so they do column sorting and paging using ajax. But they also have exposed filters exposed in blocks outside of these views (and outside of the blocktab block). I am trying to have it so submitting a filter form (which does a page request) returns to the same tab it was on when i submitted the form.

I know i can set default tab using anchor for the tab; but how can the server know which tab was current tab?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

liquidcms created an issue.

liquidcms’s picture

Oddly enough, this seems to do the trick:

(function ($, Drupal) {
  Drupal.behaviors.eps_search = {};
  let init = false;
  Drupal.behaviors.eps_search.attach = function (context, settings) {
    if (!init) {
      $("a.ui-tabs-anchor").on("click", function () {
        let action = $("form.search-filters-form").attr("action").split('#')[0];
        $("form.search-filters-form").attr("action", action + $(this).attr("href"));
      });
      init = true;
    }
  };
})(jQuery, Drupal);