add your controls to the item in the populateItem method.
protected void populateItem(ListItem item) {
item.add(new Label("name", new PropertyModel( item.getModelObject(), "name")));
}
In your case that would be:
protected void populateItem(ListItem item) {
item.add(new Label("name", item.getModelObjectAsString()));
}
and in the markup:
<p wicket:id="list"><span wicket:id="name">text goes here</span></p>
Martijn
Thanks, looking at the example again I see that.
However I have some difficulty seeing how I would be able to grab the contents of my List "forklaringer" from within the populateItem. Could you give an example?
-Nino
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Nick Heudecker
Sent: Thursday, February 23, 2006 8:42 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Listview: cannot instantiate the type
ListView is abstract. You must implement the populateItem(...) method:
new ListView("list", forklaring) {
public void populateItem(ListItem item) {
// add stuff to item.
}
};On 2/23/06, Nino Wael < [EMAIL PROTECTED]> wrote:
Hi
Im having trouble instantiateing the Listview control, I get the error "Cannot Instiantiate the type ListView" . This is within these lines the errors occur:
private wicket.markup.html.list.ListView myList;
…
List forklaring = Arrays.asList(new String[] { "Aktuelle forløb fordelt på varighed", "antal forløb", "Forløb pr. berørt", "æ", "ø", "å" });
myList = new wicket.markup.html.list. ListView("list",forklaring);
…
This part is taken from the javadoc documentation:
add(new ListView("rows", listData)
which I belive is pretty similar to the code which I've written .
- Nino
--
Living a wicket life...
Martijn Dashorst - http://www.jroller.com/page/dashorst
Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1