创建多行表头
I have a table where my column headers are set with the following instruction :
table.setColumnHeader
I wonder how can I create multilevel table headers like on this page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 Vaadin 6.7.3 开始,使用库存 Vaadin 表组件目前无法实现此操作。
在 Vaadin 7 中更改此设置会引发 Trac 问题。请参阅 https://vaadin.com /forum/-/message_boards/view_message/900369 了解更多详情。
根据您的要求,您可以隐藏表格组件的标题并尝试模拟标题(通过使用 HorizontalLayout,生成您自己的标题并侦听列调整大小事件);或者,您可以简单地生成自己的 HTML
并将其分配给标签组件。
As of Vaadin 6.7.3, this is currently not possible using the stock Vaadin table component.
There is a Trac issue raised for changing this for Vaadin 7. See https://vaadin.com/forum/-/message_boards/view_message/900369 for more details.
Depending on your requirements, you could hide the table component's header and try to simulate the header (by using a HorizontalLayout, generating your own headers and listening to column resize events); alternatively, you could simply generate your own HTML
<table></table>
and assign it to a label component.在 Vaadin7 中,您可以通过在主题中添加以下 CSS 规则来动态设置表格标题高度:
唯一的想法是列分隔符未设置为标题行高度的 100% ...
In Vaadin7 you can set the table header height dynamically by adding following CSS rule to your theme:
The only think is that the column separator is not set to 100% of the header row height ...
查看 TreeTable 组件可能会帮助您:
Vaadin 采样器
问候,
埃里克.
A look into the TreeTable component may help you :
Vaadin sampler
Regards,
Éric.
要仅设置表格的标题,请使用 setPageLength(0);这将消除表格主体并仅显示标题。
然后创建另一个带有标题和数据的表,并将这两个表组合在布局中:)
这是一个很酷的技巧,请确保第一个表头与第二个表头的比例相匹配。
To make a header only of a table use setPageLength(0); this will eliminate the table body and show only the header.
Then create another table with a header and your data and combine these 2 in a layout :)
It's a cool trick, be sure to match the ratio's of first header with the second's table header.