Palancher aurélien created WICKET-5320:
------------------------------------------

             Summary: RenderHead order is different with Ajax Request
                 Key: WICKET-5320
                 URL: https://issues.apache.org/jira/browse/WICKET-5320
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.7
            Reporter: Palancher aurélien
            Priority: Minor


Component renderHead method is called before the children renderHead in Ajax 
request.

In AjaxRequestTarget.respondHeaderContribution :

               component.renderHead(header);

                if (component instanceof MarkupContainer)
                {
                        ((MarkupContainer)component).visitChildren(new 
IVisitor<Component, Void>()
                        {
                                public void component(final Component 
component, final IVisit<Void> visit)
                                {
                                        if (component.isVisibleInHierarchy())
                                        {
                                                component.renderHead(header);
                                        }
                                        else
                                        {
                                                visit.dontGoDeeper();
                                        }
                                }
                        });
                }


When responding a normal request, in ChildFirstHeaderRenderStrategy, we have :

       @Override
        public void renderHeader(final HtmlHeaderContainer headerContainer,
                final Component rootComponent)
        {
                Args.notNull(headerContainer, "headerContainer");
                Args.notNull(rootComponent, "rootComponent");

                // First the application level headers
                renderApplicationLevelHeaders(headerContainer);

                // Than its child hierarchy
                renderChildHeaders(headerContainer, rootComponent);

                // Than the root component's headers
                renderRootComponent(headerContainer, rootComponent);
        }

This causes problems refreshing the component.
In my case : a child component executes an onload javascript function wich 
stores datas in the markup, and my root component uses them in another onload 
function. First access : datas ok, ajax refresh : the datas are not stored yet.

I have tested component.renderHead(header); after the child visitor in 
AjaxRequestTarget and it works fine.


--
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

Reply via email to