You could create a panel containing the link and the label and add that panel as the cell.... e.g. something like
<html xmlns:wicket="org.apache.wicket"> <body> <wicket:panel> <a wicket:id="link" title="" class="button"> <span wicket:id="text">[text goes here]</span> </a> </wicket:panel> </body> </html> Regards, Ernesto On Thu, Jan 14, 2010 at 2:38 PM, Johan Vogelzang <johan.vogelz...@gmail.com>wrote: > Hi all, > > I am trying out the AjaxFallbackDefaultDataTable, but have trouble when I > want to make a cell work as a link. > With the code below the table displays the word [cell] in all the cells of > the first column (Name). When I click on the cell, the correct response > page > is opened. I tried to add a Label to the link but that results into a > Wicket > error. > I red some posts about this issue, but I did not managed to find the > correct > solution. > > Who can help me? > > Regards, > Johan. > > public class ComestiblesDataTablePage extends RBSTemplate { > > @SpringBean(name = "breakfastService") > private BreakfastLocalService service; > > private Integer maxItemsPerPage = 8; > > @SuppressWarnings("serial") > public ComestiblesDataTablePage() { > > List<IColumn<ComestibleDto>> columns = new > ArrayList<IColumn<ComestibleDto>>(); > > columns.add(new PropertyColumn<ComestibleDto>(new > Model<String>("Name"), "name", "name") { > @Override > public void populateItem(Item<ICellPopulator<ComestibleDto>> > item, String componentId, > IModel<ComestibleDto> rowModel) { > > AjaxFallbackLink<ComestibleDto> link = new > AjaxFallbackLink<ComestibleDto>(componentId, rowModel) { > @Override > public void onClick(AjaxRequestTarget target) { > setResponsePage(new ComestiblePage(getModel())); > } > }; > // link.add(new Label(componentId)); --> Error: component > not markup, Component id = cell > item.add(link); > } > }); > columns.add(new PropertyColumn<ComestibleDto>(new > Model<String>("Minimal Quantity"), "minimalQuantity", > "minimalQuantity")); > columns.add(new PropertyColumn<ComestibleDto>(new > Model<String>("Price"), "price", "price")); > columns.add(new PropertyColumn<ComestibleDto>(new > Model<String>("TransportForm"), "transportForm")); > > add(new AjaxFallbackDefaultDataTable<ComestibleDto>("table", > columns, new ComestibleSortableDataProvider( > service), maxItemsPerPage)); > add(new BookmarkablePageLink<Object>("edit", > ComestiblesEditPage.class)); > } > > @Override > public String getPageTitle() { > return getLocalizer().getString("lbl.comestibles", this); > } > > } >