How do you make a link inside a PropertyColumn in Wicket?

只愿长相守 提交于 2019-12-23 22:18:24

问题


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


回答1:


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));
   }
}

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



来源:https://stackoverflow.com/questions/2711190/how-do-you-make-a-link-inside-a-propertycolumn-in-wicket

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!