【问题标题】:How to generate table header with wicket如何使用检票口生成表头
【发布时间】:2016-01-23 01:27:30
【问题描述】:

我想通过 wicket 生成这个表头

<tr>
    <th>Actions</th>
    <th>ID</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Home Phone</th>
    <th>Cell Phone</th>
</tr>

标头名称保存在arrayList中的位置

我尝试这样的事情。它生成我想要的,但在 html 代码中显示警告

- Invalid location of tag (div).

好在生成的 html 代码中没有显示 div 标签。 当我只想要th 而没有span 标签时,我不知道应该使用什么标签

        <tr>
            <div wicket:id="seasonNames"><th wicket:id="season">[season]</th></div>
        </tr>

【问题讨论】:

  • 你不能直接在中添加任何html代码而不是和 。这是错误的
  • 是的,我知道。但是使用 id=seasonNames 添加 wicket 组件的正确解决方案是什么?
  • 中有季节名称。有什么问题吗?
  • 是的,因为 seasonNames 是值列表,但值在 id=season 的组件中
  • 但你需要单曲中的所有季节吗?对吗?

标签: java html wicket


【解决方案1】:

一种方法是使用 DataTable 组件。在这种情况下,您必须传递 IColumn 实例列表并使用 HeaderToolbar。有关此方法,请参阅 Wicket 示例。

另一种方法是使用简单的转发器,例如 RepeatingView 或 ListView。在这种情况下,wicket:id="seasonNames" 应该是 而不是

【讨论】:

  • seasonNames 不能在 tr 上,因为它会创建 tr 元素列表,但我只想要 1 个 tr 元素
猜你喜欢
相关资源
最近更新 更多
热门标签