0

I have a view of events, grouped by month. Each month could have between 1 and 6 events. The pager is set to 10 items.

Example:

January
x x x
February
x x x x
March
x x
April
x

So if there are 5 events in April, the page cuts off after the first item. Even though paging can be used to navigate to the remaining events, this is misleading; it looks as though there is only 1 event in April.

So I wonder whether Views pager could work by row rather than item?

  • I see where the confusion can come from, but I'm not sure that there is a good solution. It sounds like you are wanting a paging system that has a different number of results per page, something that is technically possible but that would be computationally intensive to populate. In your example for the month of April, what would your second page look like? Would you expect it to have only the 4 remaining events, or would you want it to have all 5 (show events from the previous page)? – coreyp_1 Jul 11 '14 at 17:49
  • That's a good question. Ideally the next page would show the remaining events in April. I guess another factor is layout; if the list is styled to display rows of 3 results, there might be additional computation to take into account. hmm. – pushka Jul 13 '14 at 10:14
1

It sounds like you need a view of views. Try the module Views Field View.

I don't know if this is doable. But this is what I will investigate:

In your primary view you must create a month only field, and page on that. Then in your secondary view (which will become a field of the first view, and to which you pass the month as context) you return the dates for the passed in context of the month. You will then end up with a multi-value date field in the first view. You might have to do some rewriting of output (Views PHP?) to get the dates as text or integer fields.

And if you get it right, remember to employ views caching as Views Field View adds a lot of database queries.

| improve this answer | |
  • Thanks for this suggestion - I can certainly see how this would work. In the end, I turned off Views paging and used jQuery to page by group/month. As there aren't that many results in total, I can get away with doing that. If there were more and I needed 'real' paging, this method would be a good option. – pushka Jul 30 '14 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.