<div dir="ltr">Just for the record, I&#39;m sharing what I did..<div><br></div><div><br></div><div><div>&gt;&gt;#renderContentOn: html</div><div>...</div><div>html document addLoadScript: (self dataTableCreationScriptOn: html)<br>

</div><div>html document addLoadScript: (self tableClickHandler: html)</div></div><div><br></div><div><br></div><div><br></div><div>&quot;Bind the datatable with the jsonResponse&quot;<br></div><div><div>&gt;&gt;#dataTableCreationScriptOn: html</div>

<div><br></div><div><br></div><div><span class="" style="white-space:pre">        </span>| actionUrl |</div><div>  <span class="" style="white-space:pre">        </span>actionUrl := html actionUrl withField: (html callbacks store: (JSAjaxCallback on: [self jsonResponse])).</div>

<div><span class="" style="white-space:pre">        </span>^((JSStream on: &#39;$(&#39;&#39;#&#39; , tableId , &#39;&#39;&#39;)&#39;, &#39;.dataTable({<br></div><div><span class="" style="white-space:pre">        </span>        &quot;ajax&quot;: &quot;&#39;, actionUrl asString, &#39;&quot;,</div>

<div><span class="" style="white-space:pre">        </span>        &quot;columns&quot;: [...]})&#39;) assignTo: &#39;datatable&#39;)</div><div><span class="" style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre">&quot;Bind the row click with an ajax callback that sets the selected item in the component and then performs a JQLoad based on the id passed through the callback.&quot;                </span></div>

</div><div>&gt;&gt;#tableClickHandler: html<br></div><div><span class="" style="white-space:pre">        </span>^ (html jQuery: &#39;#&#39; , tableId , &#39; tbody&#39;)<br></div><div><div><span class="" style="white-space:pre">                </span>on: &#39;click&#39;</div>

<div><span class="" style="white-space:pre">                </span>selector: &#39;tr&#39;</div><div><span class="" style="white-space:pre">                </span>do:</div><div><span class="" style="white-space:pre">                        </span>(html jQuery ajax</div>
<div>
<span class="" style="white-space:pre">                                </span>callback: [ :value | selectedItemId := value ] value: html jQuery this text;</div><div><span class="" style="white-space:pre">                                </span>onSuccess: (self renderAjaxModalLoadOn: html) asFunction)</div>

</div><div><br></div><div><br></div><div>&quot;Loads the new html, and then invokes the show of the modal.&quot;</div><div><div>&gt;&gt;#renderAjaxModalLoadOn: html</div><div><span class="" style="white-space:pre">        </span>^ (html jQuery: &#39;#&#39; , self idModalContainer) load</div>

<div><span class="" style="white-space:pre">                </span>html: [ :ajaxHtml | self renderModalOn: ajaxHtml ];</div><div><span class="" style="white-space:pre">                </span>onComplete: ((html jQuery: &#39;#&#39;, self idModal) call: &#39;modal&#39; with: &#39;show&#39;) asFunction</div>

</div><div><br></div><div><br></div><div>I wish there was a way to simply call the JQLoad passing the argument as I do with the callback:value:, that would save me one round-trip plus not being dependant on the state.</div>

<div><br></div><div>Thank you!</div><div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div>Esteban A. Maringolo</div>
<br><br><div class="gmail_quote">2014-05-28 10:31 GMT-03:00 Esteban A. Maringolo <span dir="ltr">&lt;<a href="mailto:emaringolo@gmail.com" target="_blank">emaringolo@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Johan,<br>
<br>
2014-05-28 3:12 GMT-03:00 Johan Brichau &lt;<a href="mailto:johan@inceptive.be">johan@inceptive.be</a>&gt;:<br>
<div class="">&gt; Bob&#39;s answer is similar, but I prefer to explicitly use jQuery&#39;s on:selector:do: method.<br>
&gt;<br>
&gt; The full documentation is here: <a href="http://api.jquery.com/on/" target="_blank">http://api.jquery.com/on/</a><br>
&gt;<br>
&gt; This way of working with delegated events is really necessary if you have hundreds of callbacks to attach. That never scales and your performance will be horrible (large response size, large seaside session, ...)<br>


<br>
</div>Thanks for the advice. I looked into jQuery&#39;s docs and it&#39;s exactly<br>
what I was needing. In fact they use a dataTable as example.<br>
<br>
I added the handler this way:<br>
<br>
html document addLoadScript: ((html jQuery: &#39;#&#39;, tableId, &#39; tbody&#39;)<br>
  on: &#39;click&#39;<br>
  selector: &#39;tr&#39;<br>
  do: (<br>
    html jQuery ajax<br>
      callback: [ :value | Transcript show: &#39;Clicked row: &#39;, value; cr. ]<br>
      value: (html jQuery this text) ) asFunction)<br>
<br>
Now I need to transform that single ajax call into something more convoluted :)<br>
<br>
Thank you!<br>
<span class="HOEnZb"><font color="#888888"><br>
Esteban A. Maringolo<br>
</font></span></blockquote></div><br></div>