Hello,

I only have 1 global filter on the site. I would like users to be able to change the global filter using two different methods.

when a user clicks a link
or
When a user selects an item from a dropdown list

Can I assign the global filter with javascript?

onclick="myFunction(ChangeGlobalFilter)"

Thanks!

Comments

AgentJay’s picture

I see it is possible to have the filter in the URL, so I can append it to the Link the user selects, but I would prefer if the user did not see the query in the URL.

RdeBoer’s picture

You can use the option "Suppress URL parameters in the links of the links widget" for that.
See the Global Filter configuration page admin/config/content/global_filter

AgentJay’s picture

Thanks for the heads up! I missed that option.

do you know if it is possible to include a query as the filter value?

IE. Setting the filter to:
?field_filter=filter_value&option1=something&option2=something_else

The filter value would be "filter_value&option1=something&option2=something_else"

instead of just filter_value

Thanks for the great module.

RdeBoer’s picture

Assigned: Unassigned » RdeBoer
Status: Active » Fixed

Re #3:
Yes, see the Q&A on the project page:

Q: Is there an easy way to reset all global filters and/or reset a specific global filter?
A: Yes. Append ?clear-global-filters or ?clear-global-filters=filter_name1,filter_name2 to the URL in the browser address bar. You can also create links on your site to do this e.g. <a href="/?clear-global-filters">Clear filters</a> embedded anywhere on your site will take the visitor to the home page while also clearing all global filters to their global defaults as configured on their block configuration pages.

Q: Can I create links on my site, in an email or on another site, pointing to pages on my site AND setting one or more global filters at the same time?
A: Yes and here's an example: <a href="http://mysite.com.au/music?field_period=sixties&keys=Beatles">Articles about the Beatles in the sixties</a>. This example assumes your site features a global filter for field_period (with an index "sixties"), as well as one for a search term.

Rik

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.