我想添加到我所有的樹節點編輯和創建新的子鏈接,但我得到錯誤,與id單元格的孩子已經存在。Wicket在同一列中的兩個鏈接
columns.add(new AbstractColumn<Classification, String>(Model.of("")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<Classification>> cellItem, String componentId,
final IModel<Classification> rowModel) {
cellItem.add(new TreeLinkPanel(componentId, rowModel, tree));
}
});
columns.add(new AbstractColumn<Classification, String>(Model.of("")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<Classification>> cellItem, String componentId,
final IModel<Classification> rowModel) {
cellItem.add(new ClassificationNewLink(componentId, rowModel, tree));
}
});
現在我正在這樣做,但這個是醜陋的。我無法爲我的專欄撰寫標題。任何想法如何將兩個鏈接放在同一列?
如果我下站在你的代碼示例中,它將引發WicketRuntimeException,因爲您在同一級別的組件層次結構中添加了具有相同componentId的兩個組件,不是嗎? –
是的,你是對的。我錯過了。 – polypiel