[Seaside] Strategies for bulky renders/updates
leves at elte.hu
Sun Mar 13 12:53:32 UTC 2011
On Sun, 13 Mar 2011, radoslav hodnicak wrote:
> I've been using seaside with jquery to create quite interactive
> interfaces, using the simplest approach of "everything has its own
> callback". This works well if the dataset you're working with is
> small, but I'm now venturing into territories where it takes seconds
> to receive+render a page, which isn't acceptable.
> For an example of what I'm talking about imagine a page showing a list
> of emails. Every line (email) has a clickable sender, subject, date,
> and a bunch of more actions and icons etc. If you're creating
> anchors/click actions for each field separately, that's easily
> hundreds or thousands of callbacks per page, each needing to be
> generated on the server and sent over the wire. So clearly I need to
> user clicked and do a parametrized request. Which I can do, but I'm
> wondering if someone has figured out a clever way how to map the
> information on the page to smalltalk objects on the server (other than
> using callback registry). Same goes for bulk actions involving
> multiple items ("delete selected" and the like).
We implemented a hack, that does the following:
Instead of Seaside callbacks we implemented our own lightweight callbacks
on top of Seaside's.
We have a method, that accepts a block and a seaside canvas. The receiver
(typically a WAComponent) of the message has an OrderedCollection which
stores the callback blocks.
When you send the method, it adds the block to the collection and returns
#onChange:, etc. Something like:
do: [ self buttonClicked ]);
with: 'Click me!'
The generated html will be something like:
<button onclick="c1lc(1)">Click me!</button>
code generator when the page is rendered and it's added with
#addLoadScript: to page.
The generated function triggers a Seaside JQuery callback. The callback
accepts the index as argument, looks up the block by index and evaluates
> seaside mailing list
> seaside at lists.squeakfoundation.org
More information about the seaside