Drupal 6:使用视图在垂直 HTML 表格中显示数据
在视图中,我在两个表之间建立了关系:部门和员工。 我想使用视图以以下格式显示它:
Department A | Department B | Department C
Employee 1 Employee 5 Employee 6
Employee 2 Employee 7 Employee 8
Employee 3
Employee 4
但到目前为止,使用网格和表格样式,我只能按如下方式显示它:
Department A
Employee 1
Employee 2
Employee 3
Employee 4
Department B
Employee 5
Employee 7
Department C
Employee 6
Employee 8
我知道我可以为此创建一个模块或块,但我更愿意将其保留在视图中,并允许我们的客户随时更改它。你会如何解决这个需求?是否有一个视图钩子允许我访问数据并围绕它包装我的 HTML 表?
Iniside a view, I have a relationship set up between two tables: departments and employees.
I want to use a view to display it in the following format:
Department A | Department B | Department C
Employee 1 Employee 5 Employee 6
Employee 2 Employee 7 Employee 8
Employee 3
Employee 4
But until now, using the grid and table style, I'm only able to display it as follow:
Department A
Employee 1
Employee 2
Employee 3
Employee 4
Department B
Employee 5
Employee 7
Department C
Employee 6
Employee 8
I know I could create a module or a block for this but I would prefer to leave it inside a view and enable our client to change it whenever he wants to. How would you solve this requirement? Is there a view hook that would allow me to access the data and wrap my HTML table around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过将其设为“视图中的视图”来做到这一点。基本视图是部门视图,设置为以网格形式显示,每页 3 个网格。它将有 2 个字段 - 部门职位字段和包含员工视图的字段。如何将视图视为字段?我建议您使用设置为 PHP 的 Views Customfield 模块,并使用
views_embed_view 调用员工列表($name,$display_id)
。You can do it by making it "a view in a view". The basic view is a view of departments, set to display in a grid, with 3 grids per page. It will have 2 fields - department title field, and a field containing the view of employees. How do you put a view as a field? I suggest you use the Views Customfield module set to PHP and calling the list of employees with
views_embed_view($name, $display_id)
.