问题描述
我有一个视图,列出了 Bio
类型的内容(人物传记).但是,我想对其进行格式化,以便将它们分组在不同的标题下.
I have a View that list content of type Bio
(the biographies of people). However, I would like to format it so that they are grouped under different headings.
我在 Bios
内容类型中添加了一个新字段,这是一个包含三个不同选项的下拉列表 - Foo
、Bar
和 巴兹
.我想要做的是在他们各自组的标题下显示人员.
I added a new field to the Bios
content type which is a dropdown list with three different options - Foo
, Bar
and Baz
. What I want to do is display the people under the heading of their respective group.
目前:
- John Doe
- Jane Doe
- Jack Doe
- Juanita Doe
- Jim Doe
我想要什么:
#Foo
- John Doe
- Jane Doe
#Bar
- Jack Doe
- Juanita Doe
#Baz
- Jim Doe
推荐答案
您应该能够简单地在视图中进行分组.无需触摸模板.
You should be able to do the grouping simply within views. No need to touch the template.
分组方法如下:
- 将下拉字段添加到视图中的字段列表中.如果您不想与每个人一起显示(只想显示在顶部),请确保在设置字段时选择从显示中排除"
- 单击以配置视图格式的设置.我在示例中使用了未格式化列表",但这可以是 html 列表或表格...
- 选择您现在在视图中拥有的字段(即使您没有显示它)作为分组字段!
应该是这样的!让我们知道它是否适合您.
That should be it! Let us know if it works for you.
这篇关于Drupal 7 Views - 按字段列出分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!