为什么我的 PageableListView &分页导航不起作用?
我尝试将 PageableListView 与 PagingNavigation 一起使用。从示例来看,看起来很简单,但我无法让它工作。我总是收到以下错误消息:
以下组件未能 使成为。一个常见的问题是你 在代码中添加了一个组件,但是 忘记在标记中引用它
这是我的 java 代码:
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));
}
}
}
我的 html 看起来像这样:
<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>
有什么想法如何使其工作吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PagingNavigation 不提供任何标记。如果您想使用它,则必须为“pageLink”和“pageNumber”组件提供标记。 javadoc 指示了它们应该如何布局。
名称混乱的 PagingNavigator 是上述内容的默认版本,您可以直接放入其中(它是一个包含 PagingNavigation 的面板)。您可能只想使用它。
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.