4

There must be something obvious I'm missing as it seems from other posts that Exposed Filters in views should generate URLS from its results out of the box.

I've got some filter with ajax enabled and they work fine, but the url doesn't change when using the filter.

How to I achieve this and become able to link to a specific setting on the filter?

2

Exposed filters do create/update the page URL. You can construct a link with a combination of values for your Exposed filters and the Views results will react to it by displaying the "correct" results narrowed down to what is set in the URL.

The confusion you're having is the Ajax option. Ajax (asynchronous JavaScript and XML) option fetches only a particular part of the page data and replaces the old set of that part of the page.

Ajax doesn't reload the entire page.

URL requests are related to entire pages, the URL in your browser can't change without a Page Reload/Refresh.

The Ajax option in Views even tells you:

Options such as paging, table sorting, and exposed filters will not initiate a page refresh.

With Ajax option turned on the Exposed filters are still working correctly, you get changes in your results based on the applied Exposed filters. But the changes happen without the page reloading so the URL doesn't change. It can be confusing if you at that moment compare the currently enabled Exposed filter options with the Exposed filter values in the URL, because they won't match. But that is just the circumstances of using Ajax.

With Ajax on you get better responsiveness/speed just because there is no page reloading, but the URL might be misleading, if that is what your users pay attention to at that moment.

But turning Ajax on doesn't prevent you from constructing specific Exposed filter combinations in URLs!

You can create different URLs for a Views page, add them to a menu, when the user clicks on it they will get the filtered out results and the Exposed form options will match the URL ones. Then users can interact with the Exposed form and with Ajax on the URL will not change but the results will.

Without the Ajax option turned on each change in the Exposed form will trigger a page reload, which makes things less interactive/fast, but the URL options will match what you see on the Exposed form.

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.