Phil Kulak wrote:
You should place the link outside the list. The only things that can
be added to ListViews are components that will repeat. They're like a
foreach.
Actually, you can nest anything in a ListView. The problem here is that
the link is added to the ListView itself instead of the ListItem for
each row.
But in this case it looks like Nick wants to add it outside of the
repeating elements, in which case Phil is right: put it outside of your
ListView.
Eelco
On 7/22/05, Nick Heudecker <[EMAIL PROTECTED]> wrote:
Okay, I got that problem sorted out. I needed to add the link to the
ListItem. But it appears that OGNL is looking for a method called
addAnotherPricingOption on the Track object, which doesn't exist.
Ideas?
On 7/22/05, Nick Heudecker <[EMAIL PROTECTED]> wrote:
Hi,
I've got a custom ListView implementation that adds a Link object in
the constructor:
public ConditionalListView(String id, Track t) {
super(id);
setOptimizeItemRemoval(true);
if (isNewOrEmpty(t)) {
t.setPricingOptions(new ArrayList<Pricing>());
t.getPricingOptions().add(new Pricing());
}
setModel(new Model((Serializable) t.getPricingOptions()));
add(new Link("addAnotherPricingOption") {
public void onClick() {
List<Pricing> pricing = (List<Pricing>) getModelObject();
pricing.add(new Pricing());
ConditionalListView.this.modelChanged();
}
});
}
I'm not sure if I'm adding the new Pricing object to the list because
I'm not getting that far. When I navigate to the page, I get a
ClassCastException:
java.lang.ClassCastException: example.pages.EditTrack$ConditionalListView$1
at wicket.markup.html.list.ListView.internalOnBeginRequest(ListView.java:409)
at wicket.Component.internalBeginRequest(Component.java:1466)
at wicket.MarkupContainer.internalBeginRequest(MarkupContainer.java:289)
So where should I be putting this Link object? Do I add it to the
form? If so, how do I refer to it when the Link is in the ListView
depth of the page? Meaning: form.listView.link.
Thanks for your time.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&opclick
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user