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

and can't be changer either as far as I know.

Comments

Jerome F’s picture

Title: Provide first and last class to the wrapper, outside the list - group by field » Group by field semantics - custom markup and provide first and last class to the wrapper, outside the list

related 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

merlinofchaos’s picture

Hm. You mean you want the groups to have first/odd/even/last classes, not the rows themselves?

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

Please return this to active when the question is answered.

Jerome F’s picture

Status: Postponed (maintainer needs more info) » Active

@merlinofchaos : Thank you for your answer.
Yes I mean could the groups have first/odd/even/last classes ?

merlinofchaos’s picture

Well, 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.

Jerome F’s picture

Thank 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

merlinofchaos’s picture

Yes, that's what I mean. Sorry about not being very clear on that.

Jerome F’s picture

Ok 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.

Jerome F’s picture

For the time being I used the CSS First Child Pseudo Selector

div.view-content > div:first-child {}
merlinofchaos’s picture

Status: Active » Fixed

Right 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.

Status: Fixed » Closed (fixed)

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