我无法让按钮出现在页面上。两个标签看起来都很好,只是想知道如何让按钮也显示出来。
ListDataProvider listDataProvider = new ListDataProvider(users);
DataView dataView = new DataView<UserDetails>("row", listDataProvider) {
@Override
protected void populateItem(Item<UserDetails> item) {
UserDetails user = item.getModelObject();
RepeatingView repeatingView = new RepeatingView("dataRow");
repeatingView.add(new Label(repeatingView.newChildId(), user
.getUserName()));
repeatingView.add(new Label(repeatingView.newChildId(), user
.getAddress()));
repeatingView.add(new Button(repeatingView.newChildId()));
item.add(repeatingView);
}
};
dataView.setItemsPerPage(5);
add(dataView);
add(new PagingNavigator("pagingNavigator", dataView));
我的html是这样的:
<table>
<tr>
<th>Name</th><th>Address</th>
</tr>
<tr wicket:id = "row">
<td wicket:id="dataRow"></td>
</tr>
</table>
<div wicket:id="pagingNavigator"></div>