I have printed a table using the DefaultDataTable object in Apache Wicket.
Now I want to add a link to each table cell.
I found this link which explained some of it, but I have a problem with the first method.
columns[0] = new TextFilteredPropertyColumn(new Model("Id"), "id", "id") {
// add the LinkPanel to the cell item
public void populateItem(Item cellItem, String componentId, IModel model) {
final Transaction transaction = (Transaction) model.getObject(cellItem);
cellItem.add(new TransactionList.LinkPanel(componentId, transaction));
}
};
private class LinkPanel extends Panel {
public LinkPanel(String id, Transaction transaction) {
super(id);
final String name = transaction.getId();
PageParameters param = new PageParameters("id=" + name);
BookmarkablePageLink link = new BookmarkablePageLink("link", TransactionDetail.class, param);
link.add(new Label("label", name));
add(link);
}
What is the transaction and what does the transaction do? What is the LinkPanel class? If there is an easier way, I'll love to know it!