<div>Thanks Lukas,</div>
<div> </div>
<div>I made a working example, but i want to know if it is possible to simplify it.</div>
<div> </div>
<div>BTW the test result shows a good performance gain without the 100 callbacks.</div>
<div> </div>
<div>Render Time (with 100 callbacks) : 29 ms</div>
<div>
<div>Render Time (with 1 callback) : 6 ms</div>
<div>File Size (with 100 callbacks): 20736</div></div>
<div>File Size (with 1 callback): 8611</div>
<div> </div>
<div> </div>
<div><font face="courier new,monospace">renderContentOn: html<br> html heading: 'Callback Test'.</font></div>
<div><font face="courier new,monospace"> html script: 'function showCell(cellid) {',<br> ((html updater id: 'result'; callback: [:r | self renderResultOn: r];<br> callback: [:v | self result: v] value: (SUStream new nextPutAll: 'cellid'))) printString, '}'.</font></div>
<div><br><font face="courier new,monospace"> 1 to: 100 do: [:idx | html anchor id: 'id_', idx asString;<br> onClick: 'showCell(this.id)';<br> with: idx. html space.<br> idx \\ 20 = 0 ifTrue: [html break]].</font></div>
<div><br><font face="courier new,monospace"> html break.</font></div>
<div><font face="courier new,monospace"> html div id: 'result'; with: [self renderResultOn: html]</font></div>
<div> </div>
<div>br</div>
<div>Gerhard</div>
<div><br><br> </div>
<div class="gmail_quote">On Thu, May 1, 2008 at 10:53 AM, Lukas Renggli <<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>> wrote:<br>
<blockquote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid" class="gmail_quote">
<div class="Ih2E3d">> What is the best way to avoid too many callbacks!<br><br></div>JavaScript.<br>
<div class="Ih2E3d"><br>> I have a large table with e.g. 1000 cells.<br>> Each cell has an onClick Event with a callback.<br>> But to improve the performance, it would be<br>> better to use only one callback which sends back the selected cell id as<br>
> parameter!<br><br></div>You register single callback that passes an id of the selected cell to<br>the callback. Possibly the JsonParser I just submitted to the Seaside<br>repository might help you here to establish a simple protocol between<br>
the client and the server side.<br><br>Lukas<br><font color="#888888"><br>--<br>Lukas Renggli<br><a href="http://www.lukas-renggli.ch/" target="_blank">http://www.lukas-renggli.ch</a><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>
</font></blockquote></div><br>