[
https://issues.apache.org/jira/browse/WICKET-4874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13506458#comment-13506458
]
Martin Grigorov commented on WICKET-4874:
-----------------------------------------
I don't use <wicket:enclosure> in my applications and I highly recommend you to
avoid using it too!
I recommend to use the non-auto component
org.apache.wicket.markup.html.basic.EnclosureContainer instead.
markup:
coming up is some invisible stuff!
<div wicket:id="enclosure">
<select wicket:id="dropdown"></select>
<a wicket:id="link">click me!</a>
</div>
java code:
DropDownChoice<String> dropdown = new DropDownChoice<String>("dropdown"){ ... };
EnclosureContainer enclosureContainer = new EnclosureContainer("enclosure",
dropdown);
add(enclosureContainer);
enclosureContainer.add(dropdown);
AjaxLink<Void> link = new AjaxLink<Void>("link") { ... };
enclosureContainer.add(link);
Works as one would expect!
The problem with wicket:enclosure is that it is an auto component which is
resolved during rendering. The children components inside don't know anything
about it. They don't know its existence in the hierarchy.
AjaxEventBehavior#renderHead() wont be called at all if there was indication
that a parent in the hierarchy is invisible. But unfortunately this knowledge
comes too late.
> "Cannot find element with id" error seen in Ajax Debug for child of
> wicket:enclosure
> ------------------------------------------------------------------------------------
>
> Key: WICKET-4874
> URL: https://issues.apache.org/jira/browse/WICKET-4874
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 6.3.0
> Environment: Windows 7 x64 Java 1.6.0_32
> Reporter: Jesse Bonzo
> Priority: Minor
> Labels: ajax, enclosure, javascript
> Attachments: WicketQuickStart.zip
>
>
> When an AjaxLink is hidden due to being a child of a wicket:enclosure an
> error is seen in the Ajax Debug window. It seems like the event handler is
> expecting the AjaxLink to exist in the DOM even though it has been hidden.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira