Hello,
Your problem is that you calling setOutputMarkupId(true) on the wrong
panel (you are calling it on LawView page constructor where in fact it
should be called on the component
that is added to the ajax request target, LawPanel). Also I think the
updated panel has to replace the current instance in the page hierarchy
as well as being added to the ajax request target.
Your class could benefit from using model's in a more intelligent way.
Make the LawPanel detail panel work with an IModel<Law> model. Control
the visibility of the details panel based on if there is a Law object
present.
When an ajax link is clicked just update the model value of the details
panel with the selected Law object and add the existing LawPanel into
the AJAX request target. This will allow your link to still work when
it is just a normal link (the fallback case).
For example:
Assuming the details panel lawPanel is a private variable in the main class.
Assuming in the page constuctuor the lawPanel.setOutputMarkupId(true)
method was called.
public void populateItem(final Item item) {
AjaxFallbackLink link = new
AjaxFallbackLink("linkViewLaw") {
@Override
public void onClick(AjaxRequestTarget target) {
Law law = (Law) item.getModelObject();
lawPanel.setModelObject (law);
if(target != null) {
target.addComponent(lawPanel);
}
}
Regards,
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org