Closed (fixed)
Project:
Chaos Tool Suite (ctools)
Version:
7.x-1.x-dev
Component:
Views Content
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Aug 2011 at 12:56 UTC
Updated:
6 Nov 2020 at 05:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kardave commentedI had the same strange behavior and found that if a View display use overriden settings for paging and number of displayed items, that display is ignores the "num posts" that panel sends.
Is it a bug, or panels/ctools/views is designed this way?
Comment #2
dkingofpa commentedThe panel's "Custom pager settings: Num posts" value doesn't look like it's getting applied. This worked in D6 but is now broken in D7. Bumping priority to major as it involves broken functionality, but the module works otherwise.
Steps to reproduce:
The panel shows all items when it should be limiting the output to the number specified in the panel settings.
Comment #3
jdcc commentedI just did a bit of research into this.
The pager for the view isn't initialized before a call to get_items_per_page(). The view class pushes this call out to the view instance's pager, but as there's no pager yet, it returns NULL. This NULL leads to ctools selecting the 'none' pager instead of the 'some' pager for the view, and the 'none' pager only allows for the 'offset' option - not 'limit' - so the limit gets ignored.
I've attached a one-liner patch that fixes the issue. The argument could be made that a fix belongs in Views instead of ctools, but I don't know enough about either to make that decision.
Comment #4
merlinofchaos commentedBetter patch in #1690188: Number of Items in Initial Pane Configuration Not Respected
Comment #5
dalinNo I think the problem still exists - specifically if the view is configured to show all items, but the pane is configured to show a specific number with no pager. That other issue fixed a few other combinations, but not this one.
In short I think the line that this patch alters should mean: If the pane is not set to use a pager, and the view is not using a pager, then set the pager style based on the calculated number of rows (which uses the pane's number of rows to override the view's unlimited setting). I was hoping the plain-English would be easier to understand, but perhaps not; Just see the patch.
Comment #6
David_Rothstein commentedThe patch in #5 has an issue - if the view is configured to have a full pager but the pane is configured to have no pager, the patch prevents the view from being overridden and therefore the pager is displayed when it shouldn't be.
So we need to preserve that behavior but also fix the bug mentioned in #5. The end result is that when the pane is configured not to have a pager:
In short, we always need to run this code, so that's what the attached patch does :)
Note: Similar code exists in plugins/content_types/views_panes.inc, and my guess is that should be changed as well, but for now the patch only touches views.inc since that's where I ran into the bug.
Comment #8
drupalfan2 commentedIs this patch still necessary for latest Drupal 7 versioin?
Comment #9
edgarmxl commentedThis simple update was done on having in consideration David_Rothstein's 1254256-6-ctools-fix_pager_selection.patch but extending it on view_panes.inc as well
Comment #11
joelpittetThanks @edgarmxl for the updated patch, I've committed this to the dev branch