Using panels to render a view in one region, while the views exposed filters are rendered as a block in a seperate region, is useful when you want to:
- place your exposed filters somewhere other than the top of the view - where they appear by default
- stay on the same page when using the filters - page url doesn't change just gets appended with the query string
- use your view with a panels page - without being sent to the homepage when filtering
For this example we'll say that we've already created a content type called 'Job listings', which includes a 'location' selection. Our view will render out these 'Job listings', and the exposed filter will let you filter refine by 'location'.
1) Create the view with exposed filters
Create a view using the 'Content pane' type of display.
- You can do this by creating a view using: shows 'Content' of type 'Job listing' sorted by 'Newest first'
- When you 'continue & edit' you can add a display type of 'Content pane' by clicking the '+ Add' button under the 'Displays' title
- Set up the 'Fields' to render what you want to show, eg. 'Title' & 'Summary' (provided you're using the fields format).
Add your 'Filter Criteria' including the exposed filter, eg 'Published - yes', 'Content type - job listing', 'Location - exposed'
(the exposed filter will be enabled by enabling the 'Expose this filter to visitors, to allow them to change it' checkbox).
- Under 'Pane Settings' change 'Use Panel Path' to Yes
- Under 'Advanced' set 'Exposed form in block' to Yes
2) Create your panel page
In the main content panel region where you want your results to appear:
'Add content > View panes > View: Job listing'
in the block region where you want the exposed filters to appear:
'Add content > Views > Exposed form: job_listing-panel_panel_1'
- In the settings of your exposed filters block ensure that 'inherit path' is checked
Avid Drupal site builder & user for +9 years.