Grouping does not work - using grid style, Row style: Fields

GiorgosK - October 31, 2009 - 21:27
Project:Views
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:fixed
Description

I have looked at #596668: Grouping field not "grouping" nodes and #361298: Grouping field problem when "link to node" enabled but the outputs seems to be different
and I am using 2.x dev from Oct 29 2009 (reason being some translation fixes being committed to dev)

here is how to reproduce from a clean install of drupal 6.14

- allow story to categorize using vocabulary "color"
- "color" vocabulary contains "black" and "blue"
- create stories in this order
story1ColorBlack, story2ColorBlue, story3ColorBlack

- creating a minimal view so we can test grouping
- table style (no grouping yet),
- use fields title,body,term (accept all defaults look at first attachement for preview of view)

- modify style of table group by term
(results in on the corresponding screenshot, not all nodes get displayed)

- if we change the default order the display will be different
- change order by term
(results in on the corresponding screenshot, still not all nodes get displayed)

seems that the query is done right since views knows that there are two black nodes and one blue but they don't get displayed correctly

I have looked at #502348: How group display by mutliple fields? and apparently that patch has already been applied to the latest dev version of views which I am using

I have eclipse and debugger and running but I don't know how I can debug this, any pointers ?? Or how can I help ?

AttachmentSize
views_no_grouping.jpg11.72 KB
views_grouping_title_sorted.jpg15.05 KB
views_grouping_term_sorted.jpg15.01 KB

#1

GiorgosK - October 31, 2009 - 21:29

Sorry for the last two jpgs
Term: Black is missing on top (I actually applied wrong crop)

#2

RoboPhred - November 1, 2009 - 14:39

I am having the same issue. In my case, I am grouping a list of nodes by the domain they come from (via Domain Access). This was working fine on 6.x-2.x, but I updated to dev in order to have a functional "has new content" filter.

There should be 2 different items in my resulting view, one per domain. Both domains show up, but the single item under both is the same item from the first domain.

#3

tomsm - November 1, 2009 - 22:21

I have just submitted an issue that describes the same problem with the 6.x-3.x-dev version. See also:
http://drupal.org/node/620486

PS. Sorry for the duplicate.

#4

merlinofchaos - November 2, 2009 - 19:28
Status:active» fixed

Ok, thank you for the detailred reproduction instructions. I was able to find the cause of this and fixed it. For reference, this is the patch, but it's already applied in CVS.

AttachmentSize
fix-grouping-index-bug.patch 2.05 KB

#5

GiorgosK - November 3, 2009 - 08:36

@merlinofchaos thanks for the fast fix
the grouping does indeed work better with views 2.7 which includes the patch above

BUT,

grouping of grid style, Row style: Fields still does not work correctly
(using Row style:node does not allow grouping)

see attached image (still working with the same example above)
I tried Alignment: Horizontal and Vertical but both give same result

I checked with the debugger and the grouping is done right but

<?php
//plugin/views_plugin_style.inc line 159
       
foreach ($records as $label => $row) {
         
$rows[] = $this->row_plugin->render($row);
         
$this->view->row_index++;
        }
?>

render gets called with the right row (node) but returns a different one rendered

Checked further in the theme.inc

<?php
//theme.inc theme() line 686
   
$output = $render_function($template_file, $variables);
?>

and before $render_function gets called $variables contains mixed stuff
(content != raw) ??!!!!!!

<?php
$variables
['fields']
title    stdClass   
    content    story2colorBlue   
    raw    Story3ColorBlack   
    inline    false   
    inline_html    div   
    handler    views_handler_field_node   
    element_type    span   
   
class    title   
    label    Title   
body    stdClass   
    content   
<p>story2ColorBlue</p>n   
    raw   
<p>Story3ColorBlack</p>   
   
inline    false   
    inline_html    div   
    handler    views_handler_field_markup   
    element_type    div   
   
class    body   
    label    Body   
name    stdClass   
    content    Blue   
    raw    Black   
    inline    false   
    inline_html    div   
    handler    views_handler_field_taxonomy   
    element_type    span   
   
class    name   
    label    Term   
?>

but I am quite at a loss to debug further, but hope this helps

AttachmentSize
views-grouping-grid.jpg 10.03 KB

#6

GiorgosK - November 3, 2009 - 08:37
Title:Grouping does not work» Grouping does not work - using grid style, Row style: Fields
Status:fixed» active

Sorry forgot to change status

#7

dyke it - November 6, 2009 - 18:22

i'm also having the same issue with HTML list, unformatted and grid. the table style however is grouping things perfectly.

#8

mariagwyn - November 6, 2009 - 19:16

I am having the same issues. "Grouping field" was working fine. I don't even recall upgrading, but now, it is not working. I reinstalled 2.x-dev, no good; tried 2.7, also no good. I have tried html, unformatted, table, grid...none of them group at all.

I have attached my view.

AttachmentSize
og_landing-view.txt 16.04 KB

#9

GiorgosK - November 6, 2009 - 19:58

@mariagwyn
if you are indeed using 2.7 after upgrade there seems to be lots of issues with sorting
#622602: 2.6 to 2.7: Queries being created without ORDER BY and #624042: Sorting of data appears not to be working after update

#10

mariagwyn - November 6, 2009 - 20:36

It appears the problem has nothing to do with Views. It is the devel-Theme-Developer which is mucking up the output of all sorts of things. I turned it off and it appears that grouping in both 2.7 and 2.x-dev work just fine.

#11

dyke it - November 7, 2009 - 02:13

i'm still having the same problem with styles unformatted, html list and grid. i've tried grouping based on various different fields with no success (except in table style which works fine)

i'm using the latest dev. i also tried switching my theme to garland which doesn't work, and i do not have devel-theme-developer installed.

thank you very kindly :)

#12

dyke it - November 7, 2009 - 08:58

i updated to the latest dev and it didn't appear to be working at first, but then i changed "distinct" to "no" and it worked. grouping is now working for me on all view styles. yay views magic! :)

#13

dyke it - November 9, 2009 - 11:28

i guess i spoke too soon. my view is a related content block that is displayed on node pages. when it displays in default drupal pages (blog, poll, book etc.) it groups everything fine regardless of the view style. however, when it displays on a content type created with cck, the grouping works only with the table style - every other style does not group correctly.

EDIT: and now grouping doesn't appear to be working in any view regardless of content type or settings.

#14

VlooiVlerke - November 10, 2009 - 08:26

Same issue here. Rolling back to 2.6 fixed the problem :(

#15

Pasi - November 10, 2009 - 09:59

And also the same issue ("has new content" filter didn't work) and the same fix (2.6).

But now distinct (view og_ghp_ron with VBO) doesn't work :(

#16

merlinofchaos - November 10, 2009 - 19:59
Status:active» needs review

Try this patch, I think this fixes it for styles not named table.

AttachmentSize
619884-grouping-incorrectly.patch 2.93 KB

#17

GiorgosK - November 11, 2009 - 09:32

applied patch on 6.x-2.7 version and tested with

HTML list - row style: fields
Grid - row style: fields
Unformatted - row style: fields
Table - row style: fields

and grouping seems to be working correctly
nothing else breaks - should be good to be committed

#18

dyke it - November 15, 2009 - 09:23

Same here. I applied the patch and everything is working perfectly!! Thank you so much!!!

Used it on 6x-2.7 and tested on:

HTML list - row style: fields
Grid - row style: fields
Unformatted - row style: fields
Table - row style: fields

#19

chromix - November 24, 2009 - 22:49

I also just wanted to note that I applied this patch to 2.7 and everything with row style: fields worked great.

#20

GiorgosK - November 24, 2009 - 23:37
Status:needs review» reviewed & tested by the community

is it safe to say reviewed and tested by the community ??

#21

merlinofchaos - November 30, 2009 - 19:22
Status:reviewed & tested by the community» fixed

Applied to all branches. Thanks for testing!

 
 

Drupal is a registered trademark of Dries Buytaert.