Wicket 自定义(数据)表布局
有没有办法自定义 wicket DataTable
布局? 我想要一个具有水平数据流和每行多列的 DataTable
。
例如:
------------------------------
|prename| John| surname| Doe |
------------------------------
|city | NY | country| USA |
------------------------------
与 DataTable
类的正常使用不同,它仅用于显示一个对象(分别是一个数据集)
Is there a way to customize the wicket DataTable
layout?
I'd like to have a DataTable
with a horizontal flow of data and multiple columns per row.
e.g.:
------------------------------
|prename| John| surname| Doe |
------------------------------
|city | NY | country| USA |
------------------------------
Unlike the normal use of the DataTable
class this would be used for displaying just one object (respectively one dataset)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要为此使用
DataTable
。对于简单的情况,只需为每个数据元素创建一个包含
Label
的面板,并将表格布局放在相应的 html 片段中即可。为了使其更加动态,按照评论中所述的参数化大小,您可以使用嵌套的
RepeatingView
组件构建自己的结构,一个用于行,一个用于列,或者可能使用DataGridView
,它将为您完成一些布局工作。但是
DataTable
实际上适用于具有有意义的列式结构的表,并且包含大量用于处理列结构的代码,这些代码对您的数据没有意义,并且会妨碍您。Don't use a
DataTable
for this.For a simple case, just make a panel containing a
Label
for each data element and put the table layout in the corresponding html fragment.To make it more dynamic, with parametrized size as noted in your comment, you might build your own structure using nested
RepeatingView
components, one for the rows and one for the columns, or perhaps use aDataGridView
, which would do some of the layout work for you.But
DataTable
is really meant for a table with meaningful columnar structure and includes alot of code for handling the column structure which won't make sense for your data and will get in your way.