The attachment view does not respect the "inherit exposed filter" setting. It inherits and displays them regardless.

In this test, the node ID is passed as an argument to the attachment display via the title as a link using the [nid] token so that a selected item in the page display filtered list will be shown as the full node in the attachment display.

In addition, after selecting one item in the page display list, the full node is displayed in the attachment display as expected, but the filtered page display is reset to the state without any filters applied. The desired result is that it keeps the same filtered result, so the user can select another item to be displayed as a full node in the attachment display without having to apply the filters again.

For this simple test I selected the node ID as the exposed filter just to be generic, but any filter will give the same result.

The query run is:

SELECT node.nid AS nid,
   node.title AS node_title
 FROM node node 
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

druplicate’s picture

I can understand why the filters get reset in the page view because I think the view gets automatically rerun when the argument is passed to the attachment display and Views doesn't remember the exposed filter settings. Would using AJAX solve this?

But I can't understand why the exposed filters show up in the page and the attachment display. I'm hoping the fix for this takes care of both issues.

If it's not fixable directly, would a small Views plug-in do the trick? If so, what would that entail?

joachim’s picture

Confirming.

With:
inherit: no
display: no
I still get filters twice.

First problem is that views_plugin_display_attachment displays_exposed() is never called.
The only thing that calls displays_exposed() is view.inc, and that calls in on the current display handler, which is the page.

Beyond that I'm rather baffled as render_exposed_form() is only called once, and the form it gets is correct.
The view's build() is only called once, calls render_exposed_form(), and if I comment out that line (578 in view.inc), then both copies of the filter form go.

bfr’s picture

Put the same exposed filters to both attachment and it's parent display and set inherit to "yes" and it wont be shown twice anymore.

However, the attachment get's still filtered, so this solves only the the visual part of the problem.

jcarnett’s picture

I ran into this same issue. A workaround is to put the exposed forms in blocks and only use one of them (or set the extra form to be in a block and just ignore it).

merlinofchaos’s picture

Status: Active » Fixed
FileSize
2.93 KB

Ahh, this is a silly bug. The exposed form wasn't regenerated, it was just being rendered twice because the clone process did not actually clear the filters.

Fix committed to -dev. Patch attached.

Status: Fixed » Closed (fixed)

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