Hello,
I have a critical problem regarding the Grouping field option. This option seems to be incompatible with the preprocess functions.
Here is my problem: I have several views using unformatted style, row style. I wanted to add classes to theme raws. To do that, I added two preprocess functions, the first one to theme according to taxonomy, the second one to theme according to the signup status. Both functions are working fine, but don't work any more when I enable the grouping field option. For instance here is the preprocess function regarding the signup status :

function garland_preprocess_views_view_unformatted(&$vars) {
 $view     = $vars['view'];
 $rows     = $vars['rows'];

  if ($view->base_table == 'node') {
    foreach ($view->result as $id => $item) {
     $node = node_load($item->nid);
	if (!empty($node->signup)) {
	  $class = ' signup-enabled';
	}
	else {
	  $class = ' signup-disabled';
	}
      $vars['classes'][$id] .= $class;
    }
  }
}

Then when I enable the grouping field option, the raw styles seem to be also regrouped, that is a bit exasperating :)
It is just an example but I guess that problem should be more general.
Where comes problem from? Is Views bugged? Is the preprocess script incomplete?
This problem is really critical for my project. Please help me.
Thanks

Comments

merlinofchaos’s picture

Status: Active » Closed (won't fix)

This is how the grouping works; it actually creates one style per group. This isn't a bug, that's simply how the grouping was designed. This is why when, for example, using the table style, each group has its own table. This is actually the intended behavior.

edeation’s picture

I can understand this choice when the grouping field coincide with the theming field, it's actually legitimate. But when the fields are different, I don't.

merlinofchaos’s picture

Unfortunately, it's not a "yes in this case, no in that case" scenario. It can't work both ways.

edeation’s picture

Right Merlin. However it should be possible to override the grouping field option, isn't it? I didn't find how yet.