Why does my PageableListView & PagingNavigation not work?
I try to use a PageableListView with PagingNavigation. From the examples that looks quite easy, but I can't get it to work. I always get the following error message:
The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup
Here is my java code:
class FriendsPanel extends Panel {
public FriendsPanel(String id){
super(id);
List<User> friends = ...;
PageableListView<User> listview = new PageableListView<User>("listview", friends, 10) {
protected void populateItem(ListItem<User> item) {
User user = item.getModel().getObject();
item.add(new Label("label", user.getName()));
}
};
add(listview);
开发者_如何转开发 add(new PagingNavigation("navigator", listview));
}
}
}
My html looks like this:
<html xmlns:wicket>
<wicket:panel>
<br />
<span wicket:id="listview">
<span wicket:id="label">label</span><br>
</span>
<div wicket:id="navigator"></div>
</wicket:panel>
</html>
Any ideas how to make this work?
PagingNavigation doesn't supply any markup. If you want to use it, you'll have to supply markup for the 'pageLink' and 'pageNumber' components. The javadoc indicates how they should be laid out.
The confusingly-named PagingNavigator is a default version of the above that you can just drop straight in (it's a panel that contains a PagingNavigation). You probably want to just use that.
精彩评论