How do you make a link inside a PropertyColumn in Wicket?
I suc开发者_高级运维cessfully made an AjaxFallbackDefaultDataTable, but I want to make the contents of the cells links. How do I do this with Apache Wicket?
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.
精彩评论