<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Johan<br>
<br>
<br>
Am 11.02.17 um 10:19 schrieb Johan Brichau:<br>
</div>
<blockquote
cite="mid:5E381FCE-B7FA-4636-B09F-BACF5A1C8B02@inceptive.be"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Hey Joachim,
<div class=""><br class="">
</div>
<div class="">You can use a normal seaside callback and register
it to capture delegated events.</div>
<div class="">No magic ;)</div>
<div class=""><br class="">
</div>
<div class="">html orderedList</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>script:
(html jQuery this </div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>on:
‘click’</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>selector:
‘.mylistItemClass’ </div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>do:
((html jQuery ajax</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>callback:
[:listitemId | … ]</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>value:
(((html javascript alias: ‘event’) access: ‘target’) access:
‘id’))</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>asFunction:
#(event))</div>
<div class=""><br class="">
</div>
<div class="">This registers the callback on the list to capture
clicks on the items below it, while passing the id of the
element on which the click happened to the callback.</div>
<div class="">If you register passengers on each of the listitems,
it’s more intuitive:</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">html orderedList</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>script:
(html jQuery this </div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>on:
‘click’</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>selector:
‘.mylistItemClass’ </div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>do:
((html jQuery ajax</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>callback:
[:passenger | … ]</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>passengers:
((html javascript alias: ‘event’) access: ‘target’)</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>asFunction:
#(event))</div>
</div>
<div class=""><br class="">
</div>
<div class="">Obviously, this does not render anything yet. So, we
need to add that functionality to the callback:</div>
<div class=""><br class="">
</div>
<div class="">| idToReRender |</div>
<div class="">
<div class="">html orderedList</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>script:
(html jQuery this </div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>on:
‘click’</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>selector:
‘.mylistItemClass’ </div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>do:
((html jQuery ajax</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>callback:
[:listitemId | … idToReRender := listitemId ... ]</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>value:
(((html javascript alias: ‘event’) access: ‘target’) access:
‘id’));</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>script:
[:s | s << ((s jQuery id: idToReRender) html: [:h | self
renderMyRowWithId: idToReRender ]) ]</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>asFunction:
#(event))</div>
</div>
<div class=""><br class="">
</div>
</blockquote>
I seem to understand. This will call the server twice, once for the
setting id of which item to rerender, and a second time for the
actual rendering, right? My attempt tried to use the first ajax
callback to do both: process the business code and answer the
re-rendered row to the client, so that it just does a .replaceWith()
for the row with the re-rendered one. That is why I needed to have a
builder that the component could render itself onto.<br>
<br>
But since your aproach just registers one single callback for the
whole list, it still is an improvement compared to registering the
very same callback for each row - which takes a lot of time on both
the server and the client. And apart from the double ajax calls, it
is exactly what I want to achieve. I guess my reason for
hand-written javascript here is that I like to be able to debug it
and I know way too little about JQAjax' many options... time to
study<br>
<br>
My brain is working on this, and I am really grateful for your time
and help. I guess we should negotiate your reward in Maribor ;-)<br>
<br>
<br>
Joachim<br>
<br>
<p><br>
</p>
<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>