In AjaxLazyLoadPanel#getLazyComponent(String), you should be using the id
parameter, not "pList", when creating the PListPanel.
Andrew
@Override
public Component getLazyLoadComponent(String id) {
return new PListPanel("pList", pModel); // change
the first param from "pList" to id
}
On Mon, Apr 20, 2015 at 11:10 PM, Chris <[email protected]> wrote:
> Hi all,
>
> I am following the example from
> http://www.mkyong.com/wicket/how-do-use-ajaxlazyloadpanel-in-wicket/ but
> get following error:
>
> Last cause: Cannot replace a component which has not been added:
> id='pList', component=[PListPanel [Component id = pList]]:
> [AjaxLazyLoadPanel [Component id = pList]]
>
> By the way, is the checking for JavaEnabled valid or still needed? I have
> JavaScript enabled but the method #isJavaEnabled returns false;
>
> WebClientInfo clientInfo = WebSession.get().getClientInfo();
> if (clientInfo.getProperties().isJavaEnabled()) {
> add(new AjaxLazyLoadPanel("pList", pModel) {
> @Override
> public Component getLazyLoadComponent(String id) {
> return new PListPanel("pList", pModel);
> }
> }).setOutputMarkupId(true);
> } else {
> add(new PListPanel("pList", pModel);
> }
>
> Thanks, Chris