Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Mar 2011 at 13:46 UTC
Updated:
20 Apr 2011 at 21:21 UTC
When using group by field, the wrapper class can be set to a custom class, but there's no first last odd even classes for the moment, and it could be usefull for theming purposes (I'm running into this issue right now for example) I tried replacement patterns, but it's only for the row, and it's not needed.
The HTML markup is
Comments
Comment #1
Jerome F commentedrelated issue I found but that doesn't solve the problem :
http://drupal.org/node/945326
http://drupal.org/node/368739
http://drupal.org/node/740686
Comment #2
merlinofchaos commentedHm. You mean you want the groups to have first/odd/even/last classes, not the rows themselves?
Comment #3
merlinofchaos commentedPlease return this to active when the question is answered.
Comment #4
Jerome F commented@merlinofchaos : Thank you for your answer.
Yes I mean could the groups have first/odd/even/last classes ?
Comment #5
merlinofchaos commentedWell, while Views doesn't provide anything for this, you could attempt to add it directly in the template. Groups end up just being turned into a title. All templates have an $id, which is the number of times that particular template has been run. Though hm. I'm not sure there's any real indication of first/last that you can easily get.
Comment #6
Jerome F commentedThank you. So I can do it if I theme views-view-list.tpl.php (or a variant), is that what you mean ?
That would mean I just need to add some php code in the template and use views theme overrides to handle that.
(I'm going to do some research on this topic, because I don't know yet how to add fisrt and last classes with php.
I found http://drupal.org/node/858688 which might help me to figure something out but I'm still quite lost)
By the way even the classes there used to be aren't showing up anymore in last dev. I filed an issue there about that : http://drupal.org/node/1113482
Comment #7
merlinofchaos commentedYes, that's what I mean. Sorry about not being very clear on that.
Comment #8
Jerome F commentedOk thank you, I'll digg a bit in this directions, that can take a while as my level is still quite low in this field.
Comment #9
Jerome F commentedFor the time being I used the CSS First Child Pseudo Selector
Comment #10
merlinofchaos commentedRight now, Views' basic grouping is really naive. I think doing this right would require a new style -- trying to update the old style would likely cause cascading failures for people who've overridden their templates, but a new grouping style could do some pretty amazing stuff.