Ajax re-render fails if a instantiation listener calls setOutputMarkupId(true) 
on every component.
--------------------------------------------------------------------------------------------------

                 Key: WICKET-3584
                 URL: https://issues.apache.org/jira/browse/WICKET-3584
             Project: Wicket
          Issue Type: Bug
          Components: wicket-core
    Affects Versions: 1.4.17
         Environment: Windows Vista, JDK 1.6_22, Eclipse Helios, Maven 3.0.x
            Reporter: Ronald Tetsuo Miura


If you setup a IComponentInstantiationListener that calls 
setOutputMarkupId(true) to every component, the tags with the enclosure 
attribute don't get re-rendered on ajax requests, because the generated IDs 
from the HTML placeholder and the Ajax response don't match.

Code:

public class App extends WebApplication {
   @Override
   protected void init() {
       addComponentInstantiationListener(new IComponentInstantiationListener() {
           public void onInstantiation(Component component) {
               component.setOutputMarkupId(true);
           }
       });
   }
   @Override
   public Class<? extends Page> getHomePage() {
       return HomePage.class;
   }
}

public class HomePage extends WebPage {
   public HomePage() {
       final Label label = new Label("label", "VISIBLE!");
       add(label.setVisible(false).setOutputMarkupId(true));
       add(new AjaxLink<Void>("link") {
           @Override
           public void onClick(AjaxRequestTarget target) {
               label.setVisible(!label.isVisible());
               target.addComponent(label);
           }
       });
   }
}

<html xmlns:wicket="http://wicket.apache.org";>
<body>
<a wicket:id="link">Clique!</a>
<div wicket:enclosure="label">
 <hr/>
   <h1 wicket:id="label"></h1>
 <hr/>
</div>
</body>
</html>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to