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?
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 622608-attachment-inherit-pager_0.patch | 5.14 KB | dawehner |
| #5 | 622608-attachment-inherit-pager.patch | 4.44 KB | dawehner |
| #4 | 622608-attachment-inherit-pager.patch | 6.74 KB | merlinofchaos |
Comments
Comment #1
dawehnerI 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?
Comment #2
shpung commentedI 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.
Comment #3
merlinofchaos commentedAttachments 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.
Comment #4
merlinofchaos commentedLet's test this patch out.
Comment #5
dawehnerThere was something important missing :)
Here is a working patch :)
The pluggable pagers would need a rerole
Comment #6
sanduhrsApplied 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)
Comment #7
dagmarThese functions are the same.
I'm on crack. Are you, too?
Comment #8
sanduhrsA option to disable rendering of a second/third/fourth identical pager wouldn't be bad either.
Comment #9
dawehnerThere 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.
Comment #10
dawehner- Allows to hide but inherit the pager
Comment #11
sanduhrsWorks great!
So the redundancy of
use_pager()andrender_pager()has been ironed out.Looks good to me.
Comment #12
merlinofchaos commentedThanks for the testing! Committed to all branches!
Comment #14
c-c-m commentedIf 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.
Comment #15
rukaya commentedIn 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.