Is it possible to set up a panel page containing two views, and use one exposed filter to push data through to both of them?

As an example:
Panel page: title: View Store Directory
Contents:
Exposed Form: zipcode, distance
View1: gmap view of map centered over user's perceived location
View2: table view of stores sorted by distance to user's perceived location.

Both views are sorting and filtering their data in the same manner, so a map marker from the GMAP would also show up in the list below.

Any ideas?

Comments

merlinofchaos’s picture

Status: Active » Fixed

As long as they both use the same filter identifiers, you can just hide the exposed filter on the second view -- hiding it with CSS is simple and effective.

Xomby’s picture

Status: Fixed » Needs review

By same filter identifier, you mean the exact same filters applied to both views, correct?
[edit] If I add two views to a panel page, and submit data from one of the views (via the exposed form) the page forwards to the view's page. Going to try it again with a "panel view" instead of "page" view. Will update. [/edit]

Xomby’s picture

Status: Needs review » Closed (works as designed)

I got this working, and thank you very much for pointing me in the right direction.

For future reference, here's a full breakdown and HOW TO to get this working.

Goal:

  1. Display two views on one panel page
  2. Update the exposed filter of one view, and have that update the filter on the second view as well

Requirements:

  1. two views with the SAME filters applied to both views (e.g., in my case I was using distance/proximity filter from location module to show a list of authors by zipcode and distance)
  2. Filters exposed on BOTH views
  3. Views are not a "page" view but a "content pane" view (add->content pane)
  4. Use Panel Path (under Pane Settings in the Content Pane views) is set to YES

This updates BOTH exposed filters with the SAME data. To HIDE one of the exposed filters (using CSS as merlin suggested):

  1. You must find the ID of the exposed form you want to hide (I used "inspect element" in google chrome to zeron in on it quickly), you're looking for something along the lines of id="views-exposed-form--pane-2", which is the ID of the form's wrapper.
  2. Then, in your page style.css, add: #views-exposed-form--pane-{ display:none;}

By using display:none;, instead of visibility:hidden;, the form will not take up any space on the page, if you use visibility:hidden, the form will be hidden, sure, but you'll see a big whitespace gap where it used to be.

I hope this helps someone out!

Xomby’s picture

Title: Global Exposed Forms » Use views exposed filter to update two views on one Panel page

[SOLVED] Changing title for clarity.

rickharington’s picture

Hey guys, tried the same thing in 6.x and doesn;t work. Any hints on how I can get this done on 6? Should I rather create a new issue?

rickharington’s picture

Sorry guys. EDIT: had Ajax turned on which was the problem. Thanks for the great step by step.

Xomby’s picture

Glad I could help!

prosk’s picture

Hello, thanks for sharing.

Do you know if it's possible to do the same with Ajax on?

Thanks

dan2k3k4’s picture

Is it possible with AJAX on? I've not yet found a solution?

zmove’s picture

Same here, by sharing the filter identifier and hiding one of the 2 exposed filters, it works, but not in ajax views because the filters are not passed through a $_GET variable.

It would be great to have a solution for ajax views.

Exploratus’s picture

Issue summary: View changes

I agree. I have it working without ajax, but with ajax it would be the icing on the cake. :)

Electronic-Festivals.com’s picture

Also this is a very old post I want to add one solution which is even better for anyone that comes to this page via Google like I did.
At drupalden.co.uk it is explained how to make the filters a own block and to display them in a different pane.
http://www.drupalden.co.uk/panel-view-exposed-filters-block

This can also be used to show filters just one time on any panel you want and have the filter values used by any view with the same exposed filters.
Simply switch on "Exposed form in block" (advanced settings of the view) for all the views which have the same exposed filter.
Then in the panels page only add the filter block one time.

crutch’s picture

This post added after already closed (works as designed). However, there was no solution for ajax.

To get both results ajaxed, do the opposite of what is expected. Turn ajax off for the secondary view, leave ajax on for the primary view, instead of hiding the secondary view filter exposed in a block, hide the primary view filter exposed in a block. It's odd to me but works. Seems that the ajaxed exposed forms are listening and react upon any interaction of the non-ajax exposed forms.

Issues: the autosubmit on the non-ajaxed exposed form reloads page and there is no throbber. Been looking for a solution with no fix. There are some posts on this issue when searching involving ctools, views and better exposed filters and they don't have a solution. With other single exposed forms on the site we can show the throbber and then when the user gets to this page with the hidden exposed form and mixed ajax and non-ajax configuration, there is no throbber. User is expecting to see throbber but it doesn't happen and they are confused. So the only option for consistency is to show the submit button across all forms on the site which negates the usefulness of ajax and autosubmit.