Multiple Views sharing single Exposed filter, possible?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ppc.coder's picture

Hi,

I am trying to create a page that has multiple similiar views. I want to allow the user to be able to filter on different years using a drop down. All the views should change to reflect what the user selects. Is this possible?

I'm trying to use arguments passing with Panels but they seem to be URL based which isn't exactly what I want.

Anyone one else had to do this before?

Thank for your time.

Comments

Hullo ppc.coder. I can't

rukaya's picture

Hullo ppc.coder. I can't think of doing this with anything except arguments... If you don't want them to go in through the URL you could get the year variable from the page and embed the views manually using

<?php
echo views_embed_view('viewname', 'default/block/page', $yearvariable);
?>

I think you're right about

ppc.coder's picture

I think you're right about using arguments as the clearest way to pass values to all the views at once.
I am going to try adding a block that has filter options and will change pass arguments in the URL. That way, I'll still have the UI I want for the users. Thanks for your time!

Similar use case

donquixote's picture

I am trying the same thing.
I have a sidebar block for an issue tracker. The tracker has projects (og group node), subprojects (group post) and issues (group post with nodereference to a "subproject"). In the sidebar block I want to have a list of subprojects, then a list of issues for the current subproject, then a list of other issues in the current group/project.
On top of that I want a search field to filter all three lists all at once. I want the results to be fetched with ajax, in one big request.

I tried this with views, but then gave up and made a custom block.
I would love to get back to views, so I can use formatters, automated query building etc.

Probably I would need 3 separate displays, and then a custom module ajax page callback, which would load the views, set the arguments / filters, render the views and return the xml to embed.

Anyone done something similar? Looks straightforward, but maybe I can avoid some of the work if there is something existing :)=

Looks straightforward You

merlinofchaos's picture

Looks straightforward

You want one form to update 3 different views automatically via AJAX.

Your definition of straightforward does not match mine.

It looks straightforward to

donquixote's picture

It looks straightforward to me for a site-specific solution as described above.
Let jquery add a search textfield, and add a behavior to make an ajax callback.
Register an ajax callback with hook_menu(), get the views, set parameters, render and return as a json or just a big xml.
Then do some jquery magic to replace respective parts of the page.

Trying to make this generic and configurable, is a different story. This is why I was asking if there might be something existing.

I'm tryna do this as well now

batandwa's picture

I'm tryna do this as well now in Panel panes.

Has anyone come with a solution to this?

My idea is to use the Jump module (http://drupal.org/project/jump) and a bit of custom coding menu to switch URLs, and use arguments on the Views.
I know the person who initially posted wanted to avoid using URLs, but I can't figure out why.

What you can do is use

rahuldolas123's picture

What you can do is use different displays for creating different views and show them on single page. use blocks or panels for that.

to get a drop down selection menu for years, use an exposed filter that lets users to select the year and related data will be shown.

I am not sure about getting results in all views with just one drop down selector but try using a master display and then inherit its filters to all other displays in that view.

thanks.

Thanks. This worked.I was

batandwa's picture

Thanks. This worked.

I was actually thinking of just trying it to prove that it doesn't work, and, alas, success.

I was actually working with Cities from the Location module. This saved me from a lot of coding.

Thanks again for your suggestion.

Glad I could help.

rahuldolas123's picture

Glad I could help.

Inherit filter

kylesmith's picture

How did you get the different views to inherit the one filter?

Same search

steve.colson's picture

We were looking for the same topic recently and came across this stackexchange post:
http://drupal.stackexchange.com/questions/49264/1-better-exposed-filters...

The link you provided nailed it for me...

aaron.dietrich's picture

Thanks for providing the link. It did just the trick! The key words here are "Attachment View Display." A person usually creates a Page or Block view display. Beyond that, there are other types of view displays, including Attachments, which allows you to add a secondary view to an existing Page or Block view display. There are configuration that allows you to "Inherit exposed filters" from the view you attach to.

What I need to do: Create a

dan2k3k4's picture

What I need to do:
Create a page with 3 tabs: List, Map, and Map-3D
The List tab is a View, with an exposed filter set to a block.

I need to use the exposed filter for all 3 tabs. How can I make the Map and Map-3D tabs?

The Map tab should simply take the results from the exposed filter and use the field_id from each result to create an embedded iframe with a GET of: iframe?id=1,2,3 - where "1" "2" and "3" are the ids of the results.
The Map-3D tab would be the same just with a different iFrame URL.

I've tried using "Attachment" display in Views but that just adds the field_id to my List tab 'page' view. I don't want the field_id to "appear" anywhere. I just want the 2 other tabs (they can be anything) to inherit/get the results of the current List tab and append these ids to the iframe.

I suppose I would need to do this in a custom module/theme template for view? as I haven't found a module (or combination of modules) to do what I want.

Can anyone point me in the right direction?

How to make it works using an ajax view

zmove's picture

Hello,

I have the same problem than the others, I have a google map style page with a list results on the left and the same results, but on a map.

A view attachment is not possible in my case as I need to use panels and I don't want some hardcoded attachment behaviors.

So I can make the filter works for non ajax view. To do that, I enable exposed filters on the 2 views (the list and the map), I put exposed filters as block and I attach one of the 2 exposed filters block I have to the panel.

If your 2 views have the same filter identifier, by filling one exposed filter block you will refresh the 2 views as it refresh the whole page and take arguments from URL with $_GET.

But how can you make it works with ajax views ? As the arguments are not taken from url, when I enable ajax, it refresh only the view for which the exposed filter block is made.

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week