Dear All,
I am trying to get a Pagingnavigator using DataView.
I get following exception(Jetty 6.1.4 DEVELOPMENT mode, Wicket 1.4.5 ):
---
Unexpected RuntimeException:
WicketMessage: 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 (thus the component will never be rendered).
1. [MarkupContainer [Component id = pageLink]]
2. [Component id = pageNumber]
3. [MarkupContainer [Component id = pageLink]]
4. [Component id = pageNumber]
5. [MarkupContainer [Component id = pageLink]]
6. [Component id = pageNumber]
Root cause:org.apache.wicket.WicketRuntimeException: 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 (thus the component will never
be rendered).
1. [MarkupContainer [Component id = pageLink]]
2. [Component id = pageNumber]
3. [MarkupContainer [Component id = pageLink]]
4. [Component id = pageNumber]
5. [MarkupContainer [Component id = pageLink]]
6. [Component id = pageNumber]
at org.apache.wicket.Page.checkRendering(Page.java:1162)
at org.apache.wicket.Page.renderPage(Page.java:922)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
----
Current Class extends the WebPage. My code looks like:
IDataProvider<Contact> itemDataProvider = new IDataProvider<Contact>() {
public Iterator iterator(int first, int count) {
Object[] objs = list.toArray();
List outList = new ArrayList();
for (int i = first; i < count; i++) { // i know this is not clean
Contact c = (Contact) objs[i];
outList.add(c);
}
return outList.iterator();
}
public IModel<Contact> model(final Contact object) {
return new LoadableDetachableModel() {
@Override
protected Contact load() {
return (Contact) object;
}
};
}
public int size() {
return list.size();
}
public void detach() {}
};
DataView dataView = new DataView("mywork", itemDataProvider, 5) {
protected void populateItem(Item item) {
Contact contact = (Contact) item.getModelObject();
item.add(new Label("id", contact.getId()));
}
};
dataView.setItemsPerPage(5);
add(dataView);
add(new PagingNavigation("nav", dataView));
It works fine if I take the PagingNavigation out of code.
My HTML Code is:
<table cellspacing="0" class="dataview" >
<tbody>
<tr wicket:id="mywork">
<td><span wicket:id="id">Test ID</span></td>
</tr>
</tbody>
</table>
<span wicket:id="nav">navigation controls here</span>
Apart from this, i also tried with
new DataView("mywork", new ListDataProvider(list))
any ideas where I am wrong.
regards,
devush
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org