I am noticing that the if a page display is using a pager and has an attachment, the attachment display doesn't update its data as the pager changes, but the page display does. I am seeing this out of the box with Drupal 6.14 and the 6.2.x version of Views.

Here are the steps to recreate what I see after a fresh install with Views enabled:

1. Create content - I created 2 nodes of Page content type and 1 node of Story content type.
2. Create view - I created a node view with a "Node: Title" field. I enabled the Mini pager and set the number of items to display to 2.
3. Create displays - I created a page display with a temporary path. Then, I created an attachment display and attached it to the page. I enabled inheriting arguments & filters, but it doesn't really matter.
4. Check page - I got to the page that views created. I see the titles listed twice (once for the attachment display and once for the page display). However, if I click on the pager to see the second page, the attachment display displays the same nodes as the first page, but the page display displays the updated nodes according to the pager.

The cause seems to be in includes/view.inc, as the attachment display checks to see if 'use_pager' exists, which it doesn't for attachments. I've temporarily worked around this adding some hardcoded elements, but I'd like to see this in an official release. Are attachments suppose to sync up with their attached displays for the pager?

Comments

dawehner’s picture

Category: bug » feature

I don't know why its not in, i think that attachments are not to display main content. Its only for additions.
Its not a bug because its just not implemented.

Can you explain your tagging of the issue?

shpung’s picture

I was under the impression that the attachment and the main display should be unified based on this thread here: http://groups.drupal.org/node/16671. However, I just noticed that this issue was addressed earlier on a previous version and closed: http://drupal.org/node/368856. My bad; I guess the decision was that different displays should have different pagers.

I do think having a unified pager as an option would be useful since it allows us to present the same data in two different ways. In my situation the main display and the attachment display use different styles - one is a map showing the location of a node, and the other is a table showing additional details of a node. Because the output of the table compliments the output of the map, it doesn't make sense to have separate pagers.

merlinofchaos’s picture

Attachments weren't really meant to inherit paging, no, but I have seen a couple of valid use cases for this. It probably will require an option similar to how exposed filters might or might not be inherited.

merlinofchaos’s picture

Status: Active » Needs review
StatusFileSize
new6.74 KB

Let's test this patch out.

dawehner’s picture

StatusFileSize
new4.44 KB

There was something important missing :)

  function render_pager() {
    return !empty($this->use_pager);
  }

Here is a working patch :)

The pluggable pagers would need a rerole

sanduhrs’s picture

Status: Needs review » Reviewed & tested by the community

Applied well to 6.x-2.7
Appears to be working as advertised.

Tested
* with multiple attachments to one view.
* with and without Ajax support
* various display plugins
* pager inheritance en-/disabled (mixed aswell)

dagmar’s picture

Status: Reviewed & tested by the community » Needs work
+++ plugins/views_plugin_display_attachment.inc
@@ -229,4 +251,12 @@ class views_plugin_display_attachment extends views_plugin_display {
+  function use_pager() {
+    return !empty($this->use_pager);
+  }
+
+  function render_pager() {
+    return !empty($this->use_pager);
+  }

These functions are the same.

I'm on crack. Are you, too?

sanduhrs’s picture

A option to disable rendering of a second/third/fourth identical pager wouldn't be bad either.

dawehner’s picture

There has to be a way to distinct between some cases:
- sync pager data from other display (1)
- is the pager displayed (1.1) render_pager
- have its one pager (2)
- the pager is displayed

So there are added multiple functions.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new5.14 KB

- Allows to hide but inherit the pager

sanduhrs’s picture

Status: Needs review » Reviewed & tested by the community

Works great!
So the redundancy of use_pager() and render_pager() has been ironed out.
Looks good to me.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the testing! Committed to all branches!

Status: Fixed » Closed (fixed)

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

c-c-m’s picture

If I'm not wrong, Views version 2.8 should include this patch, but I'm still seeying that both page display and attachment block don't show the same results. Do I have to do something else? Am I doing something wrong?

Thanks

EDIT: I have solved it now. I didn't see there are new options in the attachment display that say "Inherit pager" and "render pager". I edited their values and they are working well right now. Sorry for the inconvenience.

rukaya’s picture

In my view, adding an attachment to a page and selecting 'Inherit pager: No' and 'Render pager: Yes' results in there being no pager for the attachment. If I change Inherit pager to Yes then the pager appears. Has anybody else experienced this? I presume it has something to do with this patch.