<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Joachim,<div class=""><br class=""></div><div class="">I’m a bit confused why you are rendering in this way in your callback method. </div><div class="">Why are you doing this differently than in any other Seaside rendering method?</div><div class=""><br class=""></div><div class="">Since you are instantiating a new builder, it is going to create it’s own rendercontext, hence it’s own registry for callbacks.</div><div class="">I have not deeply investigated the result of your code snippet, but this seems to me why you are seeing that callback numbers are restarted.</div><div class=""><br class=""></div><div class="">Now, if you re-render list-item with a callback on it, Seaside will indeed need to register a new callback. The memory overhead should be limited to the registry dictionary entry and a WASeasideCallback instance, however, since the block and it’s lexical context object will already exist before rendering. So… I would not worry about memory overhead.</div><div class=""><br class=""></div><div class="">If you are doing this because you are doing hand-written ajax calls: what I tend to do is generate a jQuery-Seaside ajax callback and assign this to a Javascript variable, which I can use from the hand-written JS. Of course, there’s variations on this other than global-variable assignment but that’s all Javascript fiddling.</div><div class=""><br class=""></div><div class="">So, before I try to dig deeper in your problem: why is this method not called: "changeSomeStuffOnTheServerAndRedrawOn: html” :) ?</div><div class=""><br class=""></div><div class="">Johan</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 10 Feb 2017, at 17:26, <a href="mailto:jtuchel@objektfabrik.de" class="">jtuchel@objektfabrik.de</a> wrote:</div><br class="Apple-interchange-newline"><div class="">
  

    <meta http-equiv="content-type" content="text/html; charset=utf-8" class="">
  
  <div bgcolor="#FFFFFF" text="#000000" class="">
    Dear Seasiders,<br class=""><p class="">I must bee overlooking something obvious. <br class="">
    </p><p class="">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 class="">
      This listItem contains normal anchors with callbacks. <br class="">
    </p><p class="">The ajax call is initiated in a javascript function, not rendered
      by Seaside. This call to ajax does the following;</p><p class=""><br class="">
    </p><p class="">$.ajax( ... ).done(function(result) {<br class="">
              row.replaceWith(result);});</p><p class="">    <br class="">
    </p><p class="">where row is a jquery that contains the listItem. The rerendering
      works very well and all seems good.</p><p class="">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 class="">So here is my callback method which answers the re-rendered
      listItem/row:</p><p class=""><br class="">
    </p>
    <pre class="">changeSomeStuffOnTheServerAndRedraw<tt class="">
</tt><tt class="">
</tt><tt class="">    | rahmenElementId fields req betrag planElement conv wrapper ctx contKey row resp |</tt><tt class="">
</tt><tt class="">
</tt><tt class="">
</tt><tt class="">        ctx := self requestContext.</tt><tt class="">
</tt><tt class="">        req := ctx request.</tt><tt class="">
</tt><tt class="">        resp := ctx response.</tt><tt class="">
</tt><tt class="">        fields := req fields.</tt><tt class="">

        "Some boring business stuff which works like a charm, including finding the right business objects, changing them, commits in Glorp and whatnot"</tt><tt class="">
</tt></pre>
    <tt class="">        "Re-render the row"</tt><br class="">
    <pre class=""><tt class="">        row := self findTheListItemComponentForRerendering.</tt><tt class="">
</tt><tt class="">
</tt><tt class="">        resp</tt><tt class="">
</tt><tt class="">            status: 200;</tt><tt class="">
</tt><tt class="">            contentType: (WAMimeType textHtml charset: ctx handler charSet);</tt><tt class="">
</tt><tt class="">            nextPutAll: (</tt><tt class="">
</tt><tt class="">                (self rendererClass builder)</tt><tt class="">
</tt><tt class="">"**->"              actionUrl: (ctx session actionUrlForKey: contKey);   "I also tried leaving this out --> even worse"</tt><tt class="">
</tt><tt class="">                    fullDocument: false;</tt><tt class="">
</tt><tt class="">                    render: [:html |</tt><tt class="">
</tt><tt class="">                        html render: row ])</tt><tt class="">
</tt><tt class="">
</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 class="">
    The rows not re-rendered still work like a charm.<br class="">
    <br class="">
    <br class="">
    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 class="">
    <br class="">
    <span id="cid:part1.AC5BBD04.635E1A94@objektfabrik.de"><ifioakbcdojcdbmm.png></span><br class="">
    <br class="">
    If I use the URL and replace the 1 with 51, The correct callback is
    being called, the initial callback is still registered. <br class="">
    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 class="">
    <br class="">
    Any hints? Ideas? How can I make sure the anchors in that redrawn
    listItem find their callback blocks on the server?<br class="">
    <br class="">
    <br class="">
    Thank you in advance<br class="">
    <br class="">
    Joachim <br class="">
     <tt class=""></tt><br class="">
    <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>
  </div>

_______________________________________________<br class="">seaside mailing list<br class=""><a href="mailto:seaside@lists.squeakfoundation.org" class="">seaside@lists.squeakfoundation.org</a><br class="">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside<br class=""></div></blockquote></div><br class=""></div></body></html>