Drupal 7 Views Exposed Filters in Blocks (and panels)
Share with Others
Ran into a views and panels issue today that was very simple to fix, but difficult to track down. Here is my situation in case you run into a similar views/panels issue.
I have one Drupal 7 panel page that does a lot of visibility rule filtering based on the path of the panel. Depending on the path, I have different pieces of content that show up. In some situations, this may be a view (othertimes it is static content, custom coded blocks, etc).
I wanted some of my views that are displayed in the this panel to have an exposed filter to allow easy searching. As I normally would with a view, I simply turned on the exposed filter on the views admin interface and went to make sure it was working... no luck. No exposed filter was being displayed.
I began searching for a solution and it turns out to be very simple. I have my views set up as block displays. In order for exposed filters to work with block views, you need to have Ajax enabled in the view. All I had to do to get this working, was go to the views admin and switch "use AJAX" over to "YES". After that, my exposed filters began showing up in my panel page.
A few things to note. This isn't really an issue with panels, it is only related to views being displayed as blocks, however in my situation, panels is what led me to encounter the problem. Any views block will need AJAX set to YES in order to see the exposed filters.
I also know that it is possible to set up Views Content Panes to use in my panels pages, instead of using Views Blocks. However a year or so ago, back in Drupal 6 I ran into a lot of restrictions with how Views Content Panes handled arguments and panels context, so I stopped using them. I have not used them recently so I can't say if those issues have been fixed or not yet. If anyone has arguments or opinions on why using Views Content Panes are better than using Views Blocks for displaying inside a Panel, I would be happy to hear you out.