<div dir="ltr">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:<div><br></div>
<div><div><span class="" style="white-space:pre">        </span>html form: [</div><div><span class="" style="white-space:pre">                </span>html label:[<span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">                        </span>html checkbox</div>
<div><span class="" style="white-space:pre">                                </span> onClick:  (((JSStream on: &#39;var myself = this&#39;),</div><div><span class="" style="white-space:pre">                                </span>                (html jQuery ajax</div><div><span class="" style="white-space:pre">                                </span>                          serializeThisWithHidden;</div>
<div><span class="" style="white-space:pre">                                </span>                          script: [ :s | s &lt;&lt; (((s jQuery expression:(JSStream on: &#39;myself&#39;)) closest: &#39;tr&#39;) addClass: &#39;selectedRow&#39;) ])) asFunction apply: #());</div>
<div><span class="" style="white-space:pre">                                </span>value: (self isSelected: anObject);</div><div><span class="" style="white-space:pre">                                </span>callback: [ :value | self selectRow: anObject value: value ]]]</div></div>
<div><br></div><div>But I get: SyntaxError: function statement requires a name</div><div><br></div><div><br></div><div>The onClick is being generated like this:</div><div><br></div><div>a JSFunction (function(){var myself = this;$.ajax({&quot;url&quot;:&quot;/reps&quot;,&quot;data&quot;:[&quot;_s=nHl8jzTmLkMbcOME&quot;,&quot;_k=2IH4kmR1ds-rEaua&quot;,&quot;accessMenu=Clients&quot;,&quot;activityMenu=Clients&quot;,&quot;65&quot;,$(this).next(&quot;input:hidden&quot;).andSelf().serialize()].join(&quot;&amp;&quot;),&quot;dataType&quot;:&quot;script&quot;})}())<br>
</div><div><br></div><div>Note that if I put a halt in #script, it doesn&#39;t even get call.</div><div><br></div><div>I removed the asFunction apply:   letting only something like this:</div><div><br></div><div><div> onClick:  (((JSStream on: &#39;var myself = this&#39;),</div>
<div>                (html jQuery ajax</div><div>                          serializeThisWithHidden;</div><div>                          script: [ :s |  self halt. s &lt;&lt; (((s jQuery expression:(JSStream on: &#39;myself&#39;)) closest: &#39;tr&#39;) addClass: &#39;selectedRow&#39;) ])) );</div>
</div><div><br></div><div>This solved that problem, but my row doesn&#39;t get the css class yet. The #script: does halts, and generates a script like this one:</div><div><br></div><div>a JSScript ($(myself).closest(&quot;tr&quot;).addClass(&quot;selectedRow&quot;))<br>
</div><div><br></div><div>Any ideas?</div><div><br></div><div>Thanks in advance, </div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 6, 2014 at 9:14 AM, Johan Brichau <span dir="ltr">&lt;<a 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,<br>
<br>
Both in the context of the #script: ajax callback-to-smalltalk and the ajax #onSuccess: javascript-callback option, the javascript&#39;s this variable will not hold anything related to the DOM.<br>
<br>
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>

<br>
The onSuccess parameter will accept both a string or a JSScript instance as a Javascript to be executed<br>
In a #script callback, the block argument is a JSScript instance already. The script concatenation operator &#39;&lt;&lt;&#39; 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>

<br>
cheers<br>
<span class="HOEnZb"><font color="#888888">Johan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 06 Jul 2014, at 01:06, carlo.t &lt;<a href="mailto:snoobabk@yahoo.ie">snoobabk@yahoo.ie</a>&gt; wrote:<br>
<br>
&gt; Hi<br>
&gt;<br>
&gt; I thick #script: does not work because this is a separate ajax call where<br>
&gt; the reference to &#39;this&#39; is not known and is not the row you expect.<br>
&gt; #script would work if you reference a valid DOM id for the row e.g.<br>
&gt;                                       html checkbox<br>
&gt;                                               onClick: (html jQuery ajax serializeThisWithHidden;<br>
&gt;                                                               script: [:s | s<br>
&gt;                                                                               &lt;&lt; (s jQuery: #idForRow) addClass: &#39;selectedRow&#39;]);<br>
&gt;<br>
&gt; #onSuccess is probably triggering a callback where the reference to &#39;this&#39;<br>
&gt; is valid and so the following line will work:<br>
&gt;       (html jQuery this closest: &#39;tr&#39;) addClass: &#39;selectedRow&#39;<br>
&gt;<br>
&gt; I&#39;m a javascript newbie too but thats what I think is going on.<br>
&gt;<br>
&gt; Cheers<br>
&gt; Carlo<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context: <a href="http://forum.world.st/Checkbox-and-AJAX-tp4731692p4766717.html" target="_blank">http://forum.world.st/Checkbox-and-AJAX-tp4731692p4766717.html</a><br>
&gt; Sent from the Seaside General mailing list archive at Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; seaside mailing list<br>
&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt; <a 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 href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a 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 href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
</div>