There is no AjaxRequestTarget#onComponentTagBody() The bug with #close() has been fixed in later version of Wicket.
On Fri, Jul 15, 2011 at 6:25 PM, Benedikt Rothe <[email protected]> wrote: > I made some further investigations. I do think there is a bug in wicket > 1.4.14. > > My Ajax-Request add's *two* targets which shall be rerenderd: > class MyLink extends AjaxLink<Void> { > ... > public void onClick(AjaxRequestTarget target) { > ... do Something and change visibilities ... > target.addComponent(component1); > target.addComponent(component2); > } > } > > If the JavaScript-Reference belongs to component2 the Reference will not be > rendered. > If I switch the order of the two targetAddComponet-Statements the Reference > will be rendered. > > Code-Analysis: The Ajax-Requests uses one HeaderResponse-Instance. > For each of the components the Method AjaxRequestTarget#onComponentTagBody > will > be called. After the first call onComponentTagBody will "close()" the > HeaderResponse-Instance. > Therefore the HeaderResponse-Instance rejects further Header-Contributions. > > Benedikt Rothe > > > Am 15.07.2011 16:50, schrieb Benedikt Rothe: >> >> Thank you for your good explanation. >> >> I will have to reflect about your explanation first. May be I'll come back >> :-) >> >> >> >> Am 15.07.2011 11:12, schrieb Martin Grigorov: >>> >>> Wicket calls renderHead() for each component added in the >>> AjaxRequestTarget. >>> Then for each call of IHeaderResponse.renderXYZ() Wicket checks >>> whether this is static resource and whether it is already rendered. If >>> it is not then it renders it. If it is non-static (e.g. >>> renderOnDomReady or renderOnLoad) then it is contributed every time >>> the component is re-rendered. >>> >>> Better create a quickstart and attach it to Jira. >>> >>> On Fri, Jul 15, 2011 at 11:39 AM, Benedikt Rothe<[email protected]> >>> wrote: >>>>> >>>>> Check Ajax Debug panel for errors. >>>> >>>> I did check the Ajax-Debug-Panel. No error. >>>> >>>> Situation: >>>> A Component has JavaScript-header-Contributors but is invisible. >>>> Visibility is switched during an AjaxRequest. >>>> >>>> What is Wicket's *supposed* to do? >>>> a) JavaScript-header-Contributor shall be mentioned in the Page although >>>> the >>>> Component is Wicket-Invisible >>>> b) JavaScript-header-Contributor shall be mentioned in >>>> "header-contribution"-Section of the wicket-ajax-response >>>> c) Wicket doesn't want to deal with a situation like this. >>>> >>>> >>>> Am 15.07.2011 09:46, schrieb Martin Grigorov: >>>>> >>>>> Check Ajax Debug panel for errors. >>>>> >>>>> On Fri, Jul 15, 2011 at 10:35 AM, Benedikt >>>>> Rothe<[email protected]> >>>>> wrote: >>>>>>> >>>>>>> When you say "my javascript is not loaded", do you mean it's not >>>>>>> added >>>>>>> to >>>>>>> the page or it's added but doesn't work? >>>>>> >>>>>> It is not added to the page. >>>>>> There's no script-tag. >>>>>> >>>>>> >>>>>> Am 14.07.2011 14:15, schrieb Rodrigo Heffner: >>>>>>> >>>>>>> When you say "my javascript is not loaded", do you mean it's not >>>>>>> added >>>>>>> to >>>>>>> the page or it's added but doesn't work? >>>>>>> On 14 Jul 2011 12:21, "Benedikt Rothe"<[email protected]> >>>>>>> wrote: >>>>>>>> >>>>>>>> I have a problem with IHeaderContributor and invisible Components: >>>>>>>> >>>>>>>> A Panel "MyPanel" implements IHeaderContributor. >>>>>>>> The renderHead-Methods adds some JavaScript-References. >>>>>>>> >>>>>>>> When the page is rendered this panel is invisible. >>>>>>>> So these JavaScript-References are not loaded when the page is >>>>>>>> loaded. >>>>>>>> >>>>>>>> Later visibility is switched within an Ajax-Call and the MyPanel >>>>>>>> will >>>>>>>> be >>>>>>>> rendered. >>>>>>>> But than my JavaScript is not loaded. >>>>>>>> >>>>>>>> Strange: During the Ajax-Call the renderHead-Method of MyPanel is >>>>>>>> even >>>>>>>> called, but >>>>>>>> the call doesn't provoke anything concerning the output to the >>>>>>>> browser. >>>>>>>> >>>>>>>> Any suggestions? >>>>>>>> Benedikt >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> --------------------------------------------------------------------- >>>>>>>> To unsubscribe, e-mail:[email protected] >>>>>>>> For additional commands, e-mail:[email protected] >>>>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail:[email protected] >>>>>> For additional commands, e-mail:[email protected] >>>>>> >>>>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail:[email protected] >>>> For additional commands, e-mail:[email protected] >>>> >>>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
