<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Dear Seasiders,<br>
<p>I must bee overlooking something obvious. <br>
</p>
<p>I want to redraw a listItem in and unorderedList (it is a
boostrap .list-item .row, but that doesn't really matter) in an
Ajax callback. <br>
This listItem contains normal anchors with callbacks. <br>
</p>
<p>The ajax call is initiated in a javascript function, not rendered
by Seaside. This call to ajax does the following;</p>
<p><br>
</p>
<p>$.ajax( ... ).done(function(result) {<br>
row.replaceWith(result);});</p>
<p> <br>
</p>
<p>where row is a jquery that contains the listItem. The rerendering
works very well and all seems good.</p>
<p>Except for one little detail: the callbacks rendered in the AJax
callback are re-numbered from 1 and once you click on oneof the
re-rendered link it is a nice surprise what method might get
called on the server. I guess I am messing with the _s and _k
parameters in my caööback method.</p>
<p>So here is my callback method which answers the re-rendered
listItem/row:</p>
<p><br>
</p>
<pre>changeSomeStuffOnTheServerAndRedraw<tt>
</tt><tt>
</tt><tt> | rahmenElementId fields req betrag planElement conv wrapper ctx contKey row resp |</tt><tt>
</tt><tt>
</tt><tt>
</tt><tt> ctx := self requestContext.</tt><tt>
</tt><tt> req := ctx request.</tt><tt>
</tt><tt> resp := ctx response.</tt><tt>
</tt><tt> fields := req fields.</tt><tt>
"Some boring business stuff which works like a charm, including finding the right business objects, changing them, commits in Glorp and whatnot"</tt><tt>
</tt></pre>
<tt> "Re-render the row"</tt><br>
<pre><tt> row := self findTheListItemComponentForRerendering.</tt><tt>
</tt><tt>
</tt><tt> resp</tt><tt>
</tt><tt> status: 200;</tt><tt>
</tt><tt> contentType: (WAMimeType textHtml charset: ctx handler charSet);</tt><tt>
</tt><tt> nextPutAll: (</tt><tt>
</tt><tt> (self rendererClass builder)</tt><tt>
</tt><tt>"**->" actionUrl: (ctx session actionUrlForKey: contKey); "I also tried leaving this out --> even worse"</tt><tt>
</tt><tt> fullDocument: false;</tt><tt>
</tt><tt> render: [:html |</tt><tt>
</tt><tt> html render: row ])</tt><tt>
</tt><tt>
</tt></pre>
I think the problem is either the fact that I shouldn't be using the
requestContext of the Ajax callback, or the actionUrl: part is
wrong.<br>
The rows not re-rendered still work like a charm.<br>
<br>
<br>
You can see in the attached picture that both a not-re-rendered row
and the re-rendered row point to the same 's anchors point to the
same url with identical _s and _k parameters, but thesecond one is
the re-rendered and its callback number is 1 instead of 51, which it
had before re-rendering:<br>
<br>
<img src="cid:part1.AC5BBD04.635E1A94@objektfabrik.de" alt=""><br>
<br>
If I use the URL and replace the 1 with 51, The correct callback is
being called, the initial callback is still registered. <br>
I wouldn't mind if the re-render registered another Callback, even
if that means I waste memory, but it seems I am registering the new
callbacks in some registry that's new for the ajax callback.... (I
am confused)<br>
<br>
Any hints? Ideas? How can I make sure the anchors in that redrawn
listItem find their callback blocks on the server?<br>
<br>
<br>
Thank you in advance<br>
<br>
Joachim <br>
<tt></tt><br>
<pre class="moz-signature" cols="72">
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel <a class="moz-txt-link-freetext" href="mailto:jtuchel@objektfabrik.de">mailto:jtuchel@objektfabrik.de</a>
Fliederweg 1 <a class="moz-txt-link-freetext" href="http://www.objektfabrik.de">http://www.objektfabrik.de</a>
D-71640 Ludwigsburg <a class="moz-txt-link-freetext" href="http://joachimtuchel.wordpress.com">http://joachimtuchel.wordpress.com</a>
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
</pre>
</body>
</html>