0
votes

With CCK, I've added a field to the basic "Page" node type called "Resource Type". There are four possible resource types to choose from, in a dropdown, "Training, News, Research, Tools".

I've created a view that should group the nodes by their resource type. I've created 8 nodes, 6 of which are of type "Training", 1 is of type "Tools" and 1 is of type "News". Drupal is outputting the following:

Training
- Training Node 1
- News Node 1
- Tools Node 1
- Training Node 2
- Training Node 3

Tools
- Training Node 4

News
- Training Node 5

Research
- Training Node 6

When I tested with only 1 node per resource type, it displays as expected:

Training
- Training Node 1

Tools
- Tools Node 1

News
- News Node 1

I saw the other posting where the Devel module can screw up the output, but I'm seeing the above while the user is logged out (and therefore Devel is disabled for anonymous users).

Any idea what could be going wrong? My view is set to be an "HTML List", grouped by "Resource Type".

1
In your view, do you have the "Group multiple values" checked on the title field (or whatever field is outputing 'Training Node 1', etc)? Unchecking this may give you the desired results, but I can't say for certain as I haven't tested your setup. - jhedstrom
@jhedstrom I looked at my settings, and didn't see that option. I looked at each field to see if I could find that setting, but didn't see it anywhere. You're saying it should show up when clicking on an item in the "Fields" section of a view? "Node: title" is the field that is being output for "Training Node 1", etc. Thanks for the comment, but I can't seem to find the setting. Could be user-error though :) - Carl

1 Answers

1
votes

Not 100% sure, given that I do not have your setup to make tests, but it looks like you are experiencing this issue. On comment #16 Merlin of Chaos (the author of views) provides a patch that subsequent comments seem to confirm as "working".

If that is not the case, a workaround could be for you to sort nodes instead of grouping them. You could add the grouping header by passing to the template also the node type value: you then would add the header with the type of content by comparing with the previous one. In pseudo-code:

$type_in_use = 'xxx'
if $type_of_next_node != $type_in_use then
    $type_in_use = $type_of_next_node
    print_header($type_in_use)

Just an inelegant workaround, but should work!

HTH