Hello everyone, I ran into an issue regarding the update, which is closely related to a behavior jsf2 exposes regarding component rendering<br>in the update cycle.<br><br>The main issue is following: If we have a component which we trigger with following code:<br>
<br> <myComp:javascriptTestComponent id="myTestComponent"></grv:javascriptTestComponent><br> <a href="#" name="mego3"<br> onclick="jsf.ajax.request(this,event,{execute:'myTestComponent', render:'myTestComponent'}); return false;">submit<br>
me</a><br><br>and the component itself renders following in its renderer:<br><br> ResponseWriter writer = context.getResponseWriter();<br> writer.startElement(DIV, component);<br> writer.writeAttribute(ID,component.getClientId(context), null );<br>
writer.write("hello world"+Math.random());<br> writer.endElement(DIV);<br><br> writer = context.getResponseWriter();<br> writer.startElement(DIV, component);<br> writer.writeAttribute(ID,component.getClientId(context)+":_second", null );<br>
writer.write("hello world"+Math.random());<br> writer.endElement(DIV);<br><br><br>the resulting ppr response now looks like following:<br><br><pre><code class="wrappedText focusRow"><update id="myTestComponent"><br>
<![CDATA</code><code class="wrappedText focusRow">[<div id="myTestComponent">hello world0.8619488403376933</div><br><div id="myTestComponent:_second">hello</code><code class="wrappedText focusRow"> world0.25176272071402683</div>]]><br>
</update>...</code></pre>Now the problem is, since the update part of the response is already opened the component author cannot really influence the response rendering in any meaningful way (the correct solution would be to issue two update commands here)<br>
Now the javascript has to react on the client side to resolve that situation.<br><br>Now MyFaces just replaced the original <br><pre><code class="wrappedText focusRow">myTestComponent</code></pre>
with the update code and hence the result was a div wandering down (aka wrong update)<br><br>hello world0.48748236239247755<br>hello world0.6020541783857698<br>hello world0.7181842402648805<br>hello world0.2803064696069696<br>
(after a handful of requests, with the lowest line being the first second div being dran)<br><br>now due to being incorrect a user gave me rightfully a bug issue. I dug deeper and ran the same example<br>against Mojarra, now Mojarra does cherry pick the delivered first div and replaces the original div, and omits the second one.<br>
The Problem is Mojarra just does it for newer browsers, it does the same just updating the original element with the replacement code<br>(and hence producing a wandering div) for IE6+7-<br><br>My question is, first, how to handle that problem correctly. Secondly, is this even a problem for us or more one for the component author?<br>
In the end the main problem would not exist if they ajax api could be used on the component side properly without being enforced already into an update (or to allow nested updates, inserts within an update)<br><br><br>Werner<br>
<br>