如何在 Wicket 的 PropertyColumn 内建立链接? [英] How do you make a link inside a PropertyColumn in Wicket?

查看:20
本文介绍了如何在 Wicket 的 PropertyColumn 内建立链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功制作了 AjaxFallbackDefaultDataTable,但我想制作单元格的内容链接.如何使用 Apache Wicket 执行此操作?

I successfully made an AjaxFallbackDefaultDataTable, but I want to make the contents of the cells links. How do I do this with Apache Wicket?

推荐答案

您可以使用 AbstractColumn 而不是 PropertyColumn.这将允许您添加任何您喜欢的组件,而不仅仅是 PropertyModel 的字符串值.

You can use an AbstractColumn instead of a PropertyColumn. This will allow you to add whatever component you like, rather than just the string value of the PropertyModel.

columns.add(new AbstractColumn("displayModel", "sortModel") {
   void populateItem(Item cellItem, String componentId, IModel rowModel) {
      cellItem.add(new LinkPanel(componentId, rowModel));
   }
}

其中 LinkPanel 是您要添加到单元格中的组件.

Where LinkPanel is the component you want to add in the cell.

这篇关于如何在 Wicket 的 PropertyColumn 内建立链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆