<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I'm not sure what precise goal is here, but this seems to select the
    row when the checkbox is clicked. What else was required?<br>
    <br>
    <font face="Georgia">testRender1: html<br>
      <br>
      &nbsp;&nbsp;&nbsp; | isSel someData selections setSel ss |<br>
      &nbsp;&nbsp;&nbsp; <br>
      &nbsp;&nbsp;&nbsp; selections _ Set new.<br>
      &nbsp;&nbsp;&nbsp; someData _ #('hello' 'goodbye' 'what?').<br>
      &nbsp;&nbsp;&nbsp; isSel _ [ :obj | selections includes: obj].<br>
      &nbsp;&nbsp;&nbsp; setSel _ [ :obj :val | val ifTrue: [selections add: obj]
      ifFalse: [selections remove: obj]].<br>
      &nbsp;&nbsp;&nbsp; html table with: [<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; someData do: [ :e |<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html tableRow with: [<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html tableData: e.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html tableData: e sorted.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html tableData with: [<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html form: [<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html label:[&nbsp;&nbsp;&nbsp; <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ss _ (html jQuery this closest: 'tr')
      addClass: 'selectedRow'.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html checkbox<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; onClick: (html jQuery ajax&nbsp;
      serializeThisWithHidden);<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; onClick:&nbsp; (ss);<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; value: (isSel value: e);<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; callback: [ :value | setSel value:
      e value: value ]<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ]<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].<br>
      &nbsp;&nbsp;&nbsp; ].<br>
      <br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 7/8/14 9:06 AM, Mariano Martinez
      Peck wrote:<br>
    </div>
    <blockquote
cite="mid:CAA+-=mX1zZSV+htDZ2turFneV1k6yYxtw1+y01JD-N1-+n_iVw@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote">On Mon, Jul 7, 2014 at 6:02 PM, Johan
            Brichau <span dir="ltr">&lt;<a moz-do-not-send="true"
                href="mailto:johan@inceptive.be" target="_blank">johan@inceptive.be</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
              Mariano,<br>
              <br>
              Unfortunately, the trick with capturing 'this' for later
              use is not going to work. The generated script (or the
              onSuccess callback) are not executed in the same scope as
              where you defined 'myself'.<br>
            </blockquote>
            <div><br>
            </div>
            <div>Ok, I imagined that something like that could happen.&nbsp;</div>
            <div>&nbsp;</div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">I made
              that mistake in this thread earlier on, but I was just not
              thinking right. Sorry about that.<br>
              <br>
            </blockquote>
            <div><br>
            </div>
            <div>Np, it was a good try to avoid having an id for every
              row ;)</div>
            <div>&nbsp;</div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              The problem with the apply: is that the apply statement is
              added inside the function. I noticed that problem with
              JSFunction objects before but I don't know yet if it can
              be solved. It does act counter-intuitive though.<br>
              <br>
            </blockquote>
            <div><br>
            </div>
            <div>Indeed.</div>
            <div>&nbsp;</div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              Working with an id per row is the easiest solution here, I
              think.<br>
              <span class="HOEnZb"><font color="#888888"><br>
                </font></span></blockquote>
            <div><br>
            </div>
            <div>OK, perfect.&nbsp;</div>
            <div><br>
            </div>
            <div>Thank you very much guys,&nbsp;</div>
            <div>&nbsp;</div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <span class="HOEnZb"><font color="#888888">
                  Johan<br>
                </font></span>
              <div class="HOEnZb">
                <div class="h5"><br>
                  On 07 Jul 2014, at 15:42, Mariano Martinez Peck &lt;<a
                    moz-do-not-send="true"
                    href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>&gt;
                  wrote:<br>
                  <br>
                  &gt; Thank you all for the explanations. I do get it
                  now. Now that I made the simplest case to work (adding
                  an id per tr), I would like to make the Johan solution
                  (finding the closest tr). I tried:<br>
                  &gt;<br>
                  &gt; &nbsp; &nbsp; &nbsp; html form: [<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html label:[<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html checkbox<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;onClick:
                  &nbsp;(((JSStream on: 'var myself = this'),<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                  (html jQuery ajax<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; &nbsp; &nbsp; serializeThisWithHidden;<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; &nbsp; &nbsp; script: [ :s | s &lt;&lt; (((s jQuery
                  expression:(JSStream on: 'myself')) closest: 'tr')
                  addClass: 'selectedRow') ])) asFunction apply: #());<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value: (self
                  isSelected: anObject);<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callback: [ :value
                  | self selectRow: anObject value: value ]]]<br>
                  &gt;<br>
                  &gt; But I get: SyntaxError: function statement
                  requires a name<br>
                  &gt;<br>
                  &gt;<br>
                  &gt; The onClick is being generated like this:<br>
                  &gt;<br>
                  &gt; a JSFunction (function(){var myself =
this;$.ajax({"url":"/reps","data":["_s=nHl8jzTmLkMbcOME","_k=2IH4kmR1ds-rEaua","accessMenu=Clients","activityMenu=Clients","65",$(this).next("input:hidden").andSelf().serialize()].join("&amp;"),"dataType":"script"})}())<br>
                  &gt;<br>
                  &gt; Note that if I put a halt in #script, it doesn't
                  even get call.<br>
                  &gt;<br>
                  &gt; I removed the asFunction apply: &nbsp; letting only
                  something like this:<br>
                  &gt;<br>
                  &gt; &nbsp;onClick: &nbsp;(((JSStream on: 'var myself = this'),<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (html jQuery ajax<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                  serializeThisWithHidden;<br>
                  &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; script: [ :s | &nbsp;self
                  halt. s &lt;&lt; (((s jQuery expression:(JSStream on:
                  'myself')) closest: 'tr') addClass: 'selectedRow') ]))
                  );<br>
                  &gt;<br>
                  &gt; This solved that problem, but my row doesn't get
                  the css class yet. The #script: does halts, and
                  generates a script like this one:<br>
                  &gt;<br>
                  &gt; a JSScript
                  ($(myself).closest("tr").addClass("selectedRow"))<br>
                  &gt;<br>
                  &gt; Any ideas?<br>
                  &gt;<br>
                  &gt; Thanks in advance,<br>
                  &gt;<br>
                  &gt;<br>
                  &gt;<br>
                  &gt;<br>
                  &gt;<br>
                  &gt; On Sun, Jul 6, 2014 at 9:14 AM, Johan Brichau
                  &lt;<a moz-do-not-send="true"
                    href="mailto:johan@inceptive.be">johan@inceptive.be</a>&gt;
                  wrote:<br>
                  &gt; Hi,<br>
                  &gt;<br>
                  &gt; Both in the context of the #script: ajax
                  callback-to-smalltalk and the ajax #onSuccess:
                  javascript-callback option, the javascript's this
                  variable will not hold anything related to the DOM.<br>
                  &gt;<br>
                  &gt; The difference between #script: and #onSuccess:
                  is that the former defines a script rendering callback
                  to be executed in Seaside and the latter is a jQuery
                  ajax option to define a javascript callback (to be
                  executed client-side) when the ajax call finishes
                  successfully.<br>
                  &gt;<br>
                  &gt; The onSuccess parameter will accept both a string
                  or a JSScript instance as a Javascript to be executed<br>
                  &gt; In a #script callback, the block argument is a
                  JSScript instance already. The script concatenation
                  operator '&lt;&lt;' expects another JSScript instance
                  (e.g. a JSStream instance). If you concatenate a
                  Smalltalk string with a JSScript instance, the
                  Smalltalk string is serialized as a Javascript string
                  on the JSScript instance.<br>
                  &gt;<br>
                  &gt; cheers<br>
                  &gt; Johan<br>
                  &gt;<br>
                  &gt; On 06 Jul 2014, at 01:06, carlo.t &lt;<a
                    moz-do-not-send="true"
                    href="mailto:snoobabk@yahoo.ie">snoobabk@yahoo.ie</a>&gt;
                  wrote:<br>
                  &gt;<br>
                  &gt; &gt; Hi<br>
                  &gt; &gt;<br>
                  &gt; &gt; I thick #script: does not work because this
                  is a separate ajax call where<br>
                  &gt; &gt; the reference to 'this' is not known and is
                  not the row you expect.<br>
                  &gt; &gt; #script would work if you reference a valid
                  DOM id for the row e.g.<br>
                  &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html
                  checkbox<br>
                  &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; onClick: (html jQuery ajax serializeThisWithHidden;<br>
                  &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; script: [:s | s<br>
                  &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; (s jQuery:
                  #idForRow) addClass: 'selectedRow']);<br>
                  &gt; &gt;<br>
                  &gt; &gt; #onSuccess is probably triggering a callback
                  where the reference to 'this'<br>
                  &gt; &gt; is valid and so the following line will
                  work:<br>
                  &gt; &gt; &nbsp; &nbsp; &nbsp; (html jQuery this closest: 'tr')
                  addClass: 'selectedRow'<br>
                  &gt; &gt;<br>
                  &gt; &gt; I'm a javascript newbie too but thats what I
                  think is going on.<br>
                  &gt; &gt;<br>
                  &gt; &gt; Cheers<br>
                  &gt; &gt; Carlo<br>
                  &gt; &gt;<br>
                  &gt; &gt;<br>
                  &gt; &gt;<br>
                  &gt; &gt;<br>
                  &gt; &gt; --<br>
                  &gt; &gt; View this message in context: <a
                    moz-do-not-send="true"
                    href="http://forum.world.st/Checkbox-and-AJAX-tp4731692p4766717.html"
                    target="_blank">http://forum.world.st/Checkbox-and-AJAX-tp4731692p4766717.html</a><br>
                  &gt; &gt; Sent from the Seaside General mailing list
                  archive at Nabble.com.<br>
                  &gt; &gt;
                  _______________________________________________<br>
                  &gt; &gt; seaside mailing list<br>
                  &gt; &gt; <a moz-do-not-send="true"
                    href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
                  &gt; &gt; <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
                    target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
                  &gt;<br>
                  &gt; _______________________________________________<br>
                  &gt; seaside mailing list<br>
                  &gt; <a moz-do-not-send="true"
                    href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
                  &gt; <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
                    target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
                  &gt;<br>
                  &gt;<br>
                  &gt;<br>
                  &gt; --<br>
                  &gt; Mariano<br>
                  &gt; <a moz-do-not-send="true"
                    href="http://marianopeck.wordpress.com"
                    target="_blank">http://marianopeck.wordpress.com</a><br>
                  &gt; _______________________________________________<br>
                  &gt; seaside mailing list<br>
                  &gt; <a moz-do-not-send="true"
                    href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
                  &gt; <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
                    target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
                  <br>
                  _______________________________________________<br>
                  seaside mailing list<br>
                  <a moz-do-not-send="true"
                    href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
                  <a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
                    target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          Mariano<br>
          <a moz-do-not-send="true"
            href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>