views:

332

answers:

1

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  A: 

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

mac
I appreciate the reply. I know it's difficult to debug while completely in the dark.As far as your first comment goes--I'm using the latest development release 6.x-3.0-alpha1 and according to the bug report comments you linked-to, the patch listed was applied to all branches. I tried applying the patch anyway, but no luck.I'm going to give your second suggestion a try, just to see where it gets me. I'll report back here if all goes well, and mark this as answered.Thanks again!
Carl
Hmm, now I'm confused. I was editing my template files, looked at my list, and then logged out. Once logged out, the view rendered fine! I didn't change anything either, except for adding some logic in there to limit the number of items output per group. So weird!I imagine your second solution would work, so I'm going to chalk it up as an answer, and move on. Thank you for your time!
Carl

related questions