Thanks for this great module.

Is there a possibility to create a view-tree with grouping fields? I'm sort of looking for something like this.
Project 1
(Tree 1)
Task 1
Task 1.1.
Task 2
Taks 2.2
Project 2
Task 3
Task 3.1
Taks 3.2

Where a task has a parent task and an project.

If there is a place to start i'm willing to test / help.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nicholas.alipaz’s picture

Would like to say that this would be a nice addition, one use case is a view of terms grouped by vocabulary names:

Vocab 1:
 - Parent term
 - - Child term
 - Parent term 2
Vocab 2:
 - Parent term 3
 - - Child term 2
nicholas.alipaz’s picture

Status: Active » Needs review
FileSize
1.32 KB

Here is a patch against git 7.x-2.x branch. It is working for me and shouldn't have any regressions for current functional non-grouped views.

nicholas.alipaz’s picture

BTW, this made possible a list of all taxonomy terms on my site grouped by vocabulary in weighted hierarchical order. There is no other contributed solution for this that I have found.

Example can be seen in right sidebar here:
http://pixarcarsdiecastwiki.com/

devad’s picture

Issue summary: View changes

Thanks Nicholas. It worked for me as well.

However, I left 'uses grouping' option as TRUE.

- 'uses grouping' => FALSE,
+ 'uses grouping' => TRUE,

It would be nice to have this patch refreshed, tested and commited.

(Patches are not in my skills)

devad’s picture

Status: Needs review » Needs work
devad’s picture

Status: Needs work » Needs review
FileSize
2.77 KB

Patch refreshed against latest .dev

#4 change included

NWOM’s picture

Category: Support request » Feature request
Status: Needs review » Needs work

The following error is shown after applying the patch:

Notice: Undefined variable: grouping_enabled in theme_views_tree_inner() (line 136 of /var/aegir/platforms/drupal-7.39/sites/test-dropzone.soft-nrg-portal.de/modules/views_tree/views_tree.module).

devad’s picture

What patch did you apply nwom? #2 or #6 ? Against 2.0 or against 2.0-dev ? Did you apply the patch manually or automatically?

If you can post all lines of your function "theme_views_tree_inner($variables)" together with line numbers after you have applied the patch this would help to find why you get undefined variable notice.

NWOM’s picture

I patched #6 manually on 2.0-dev. I hadn't mentioned this since the thread's Version is set to 7.x-2.x-dev and #6 was the last patch made for the latest dev.

I'm not in the office again until Monday, and can try and debug and automatically apply it then. I assume it's just a small PHP5.5 incompatibility notice where one of the variables isn't declared with "isset".

scottsawyer’s picture

I wound up solving this with Views Field View and multiple view displays, wanted to share in case it helps anyone with this issue in the future.

I needed to create an organizational chart with Committees, Committee Positions, and Committee Members

Committees and Committee Positions are Vocabularies, Committee Positions can appear in one or more Committees (term reference field), and a Committee Member is a Profile2 User with a Committee Position (term reference).

I create 3 views:

View 1 - Users
Display: Block
Format: Tree
Fields:
- Name
- Phone Number
Relationships:
- User profile
- Term from profile field ( field_committee_position )
Contextual Filter:
- Term ID ( relationship term from profile field )
Sort:
- Term Weight ( relationship term from profile field )

View 2 - Taxonomy Terms
Display: Block
Format: Tree
Fields:
- Term Name
- Term ID ( exclude from display )
- View -> View 1 [block] pass in [tid]
Relationships:
- Term from field ( field_committee )
Contextual Filter:
- Term ID ( relationship from field )
Sort
- Term Weight ( relationship from field )

View 3 - Taxonomy Terms
Display: Page
Format: Tree
Fields:
- Term Name
- Term ID ( exclude from display )
- View -> View 2 [block] pass in [tid]

Now I get:
Org Chart

  • Executive Committee
    1. President
      • Mike Smith - (555) 555-5555
    2. Vice President
      • Mary Johnson - (222) 222-2222
  • Awesome Committee
    1. Committee Chair
      • John Bad - (222) 222-2222
    2. Treasurer
      • Sara Sweet - (555) 555-5555