[Seaside] How to avoid too many callbacks

Gerhard Obermann obi068 at gmail.com
Thu May 1 15:39:52 UTC 2008


Thanks Lukas,

I made a working example, but i want to know if it is possible to simplify
it.

BTW the test result shows a good performance gain without the 100 callbacks.

Render Time (with 100 callbacks) : 29 ms
 Render Time (with 1 callback) : 6 ms
File Size (with 100 callbacks): 20736
File Size (with 1 callback): 8611


renderContentOn: html
 html heading: 'Callback Test'.
 html script: 'function showCell(cellid) {',
     ((html updater id: 'result'; callback: [:r | self renderResultOn: r];
      callback: [:v | self result: v] value: (SUStream new nextPutAll:
'cellid'))) printString, '}'.

  1 to: 100 do: [:idx | html anchor id: 'id_', idx asString;
       onClick: 'showCell(this.id)';
       with: idx. html space.
       idx \\ 20 = 0 ifTrue: [html break]].

 html break.
 html div id: 'result'; with: [self renderResultOn: html]

br
Gerhard



On Thu, May 1, 2008 at 10:53 AM, Lukas Renggli <renggli at gmail.com> wrote:

> > What is the best way to avoid too many callbacks!
>
> JavaScript.
>
> > I have a large table with e.g. 1000 cells.
> > Each cell has an onClick Event with a callback.
> > But to improve the performance, it would be
> > better to use only one callback which sends back the selected cell id as
> > parameter!
>
> You register single callback that passes an id of the selected cell to
> the callback. Possibly the JsonParser I just submitted to the Seaside
> repository might help you here to establish a simple protocol between
> the client and the server side.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080501/d7546a60/attachment.htm


More information about the seaside mailing list