[
https://issues.apache.org/jira/browse/WICKET-5082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13595076#comment-13595076
]
Nick Pratt edited comment on WICKET-5082 at 3/6/13 8:49 PM:
------------------------------------------------------------
I dug around, and here's what's happening:
In normal rendering, all the items go in to the on dom ready, all appended to
the same list in the Response. In an Ajax response, the Wicket added JS for
the click handlers get stored in the response.appendJavaScripts, and then, even
though the parent was visited last (I replaced the
AbstractAjaxResponse.writeHeaderContributor with the same code from
ChildFirstHeaderRenderStrategy), the parent's JS was going in to the
domReadyJavaScripts - which ultimately are added to the page before the child
JS (stored in appendJavaScripts).
While I have a workaround (an explicit check to see if we are in an
AjaxRequest, and then adding to the appendJavaScripts in that case, and the
modification of the wicket-core AbstractAjaxResponse to do a ChildFirst
traverse), it seems a bit of a hack - I think the order of rendering and JS
appends should be the same in both the non-Ajax and Ajax cases.
was (Author: nickpratt):
I dug around, and here's what's happening:
In normal rendering, all the items go in to the on dom ready, all appended to
the same list in the Response. In an Ajax response, the Wicket added JS for
the click handlers get stored in the response.appendJavaScripts, and then, even
though the parent was visited last (I replaced the
AbstractAjaxResponse.writeHeaderContributor with the same code from
ChildFirstHeaderRenderStrategy), the parent's JS was going in to the
domReadyJavaScripts - which ultimately are added to the page before the child
JS (stored in appendJavaScripts).
While I have a workaround (an explicit check to see if we are in an
AjaxRequest, and then adding to the appendJavaScripts in that case), it seems a
bit of a hack - I think the order of rendering and JS appends should be the
same in both the non-Ajax and Ajax cases.
> Ajax update renders parent/child JS in different order than initial Page
> render
> -------------------------------------------------------------------------------
>
> Key: WICKET-5082
> URL: https://issues.apache.org/jira/browse/WICKET-5082
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 6.6.0
> Reporter: Nick Pratt
> Attachments: quickstart.tar.gz
>
>
> See attached quickstart. On initial page load, the child Javascripts are
> rendered and executed first, followed by the parent's JS - in this case a
> Datatables.net JS. Everything works fine.
> However, if you click on a link in the DefaultDataTable, we trigger a DDT
> refresh via Ajax, and then you can see that the parent's JS is executed
> first, before the child JS - this causes a problem since the parent JS
> modifies the visible rows in the table and Wicket can no longer find some of
> the child rows.
> I expected the order of JS contributions to be the same for initial page
> render and any Ajax updates.
--
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