I haven't had time to extensively test this, but I have a view set up with a number of exposed filters, that are also filtered using the selective exposed module. The reset button simply does not reset the filters.

CommentFileSizeAuthor
#10 981994-views_hacks-reset-button.patch1.01 KBsnufkin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

infojunkie’s picture

* Is the view using Ajax?
* Is the exposed filter form placed on the page or in a block?
* Can you open Firebug and check if there's an error reported in the console? Both upon loading the page and when clicking Reset.

Thanks!

snufkin’s picture

The view is not using ajax, the exposed filter is in the page.

No errors in firebug either.

One thing occurred to me, would it not be better to use standard drupal form api definition for the button? like this:

  $form['reset'] = array(
    '#type' => 'button',
    '#value' => t('Reset'),
    '#attributes' => array(
      'id' => 'edit-reset',
      'class' => 'form-submit'
    ),
  );

I will try to write a patch tomorrow.

cybermache’s picture

subscribing

infojunkie’s picture

Status: Active » Postponed (maintainer needs more info)

There's not enough information for me to find out why Reset is not working in your cases. You can send me a link to your online installations for me to take a look.

jamiehollern’s picture

I'm having this issue also. When the button is clicked, nothing happens at all. My view isn't using AJAX although the filter is a block. No errors in Firebug.

infojunkie’s picture

It's possible that the button and form ids that the reset script is using are wrong. Can someone check this? E.g using console.log(Drupal.settings.vfr) and comparing the keys with existing form ids. Also, check that the reset button's id is indeed edit-reset in the page. Thanks!

Les Lim’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

I'm fairly certain this is a duplicate of #946488: Views Filters Reset does not work when "Remember last setting" is checked.. If the filters in question here do not have the "Remember" option enabled, please re-open this issue.

infojunkie’s picture

To those having the problem here, can you confirm that you are using the "Remember last setting" option for your exposed filters?

cybermache’s picture

I don't have Ajax enabled and my exposed filter is in a block. Turning off the 'remember' option does bring back the reset capability, sort of. In my instance I have 7 options to filter with. If all of them are selected when I disable the 'remember' option then this will be what the reset button reverts to. If two are selected that will be the 'reset'. I have tried emptying my cache files and deselecting, saving, and re-selecting the 'reset' option in my view. These do not seem to have any affect. It seems like maybe this field is not being emptied successfully? I would agree that this is a duplicate of #946488 and that the suggestion there about changing the 'reset' button type might be a good place to start.

IMHO

snufkin’s picture

Status: Closed (duplicate) » Needs review
FileSize
1.01 KB

I got it fixed using the get_url() instead of get_path() on the views object. If the view uses arguments this substitutes them and thus redirects correctly (eg. old behaviour redirected me to taxonomy/term/%, this is fixed with this).

And using this issue because i did not have my remember last setting checked.

infojunkie’s picture

Status: Needs review » Fixed

Seems to work fine on my side. Committed to latest dev. Thanks!

sammo’s picture

Hi this didn't work for me.

I'm doing something quite complicated by using an exposed filter from the default display (in a block), to update the exposed filters of multiple block displays and page displays. The default display can not use ajax (there is no default page to update), so this is disabled by default, plus I need a page load anyway so that multiple blocks can update.

I'm not good with jQuery (yet) but a quick look had me change this code in the views_filters_reset.js file:


if (url) {
        window.location = url;
      }

to this:

if (url) {
        window.location = url;
        $('form#'+form_id, context).clearForm();
        $('form#'+form_id, context).submit();
      }

This has fixed the issue for me. Does this make sense? Should I roll a patch?

Thanks.

sammo’s picture

Status: Fixed » Needs review
infojunkie’s picture

Re #12: I don't understand what this code does. *After* it redirects the browser window to the reset URL, it clears the form and submits it? Is the original page still loaded at this point?

sammo’s picture

Well if I change to code to:

      if (url) {
        $('form#'+form_id, context).clearForm();
        $('form#'+form_id, context).submit();
        window.location = url;

      }

It will only work if I click reset after I have been redirected - so I am clicking reset twice. I guess the reset needs to be called from the page it redirects to or else it doesn't work?

tanma’s picture

Hi there
First thanks for this great module, just what I needed!
Though I'm having some difficulty getting things to work as I think they are meant to?

Views Hacks 6.x-1.x-dev
Views 6.x-2.11
Core 6.17

I have a view with 8 exposed filters. 4 of them are Term ID (with depth) to get specific taxonomies. I installed the module and turned on the filter auto-submit which worked perfectly. But when I turned on filters reset, clicking on the Reset button doesn't seem to do anything, the filters were not reset

Not using ajax, the exposed filter is on a page, and firebug doesn't have any error on page load or reset click.
Neither do I have the "Remember" option enabled. I can give you access to the site if you want to check it out for yourself.

I thought the dev version might fix the prob....

Tan

ryank76’s picture

I'm having the same issue as #9:

If all of them are selected when I disable the 'remember' option then this will be what the reset button reverts to. If two are selected that will be the 'reset'.

My view is not in a block. 'Remember' is not enabled for either of my 2 filters.

I tried unchecking 'Force single' and unchecking all the checkboxes for the filter then disabling 'Remember', but this meant that when it resets it chooses every option instead of none.