[Seaside] Re: Re: Re: Ajax callback question: how to
updatecomponenttreebefore #children gets called?
renggli at gmail.com
Fri Feb 8 17:21:32 UTC 2008
> > - declare all tab components as children (!)
> Yes, this does work, but I don't understand why it is necessary.
> #renderContentOn: will only #render: the #selected tab, never any of the
Let's face it, it is complicated and Seaside doesn't get it quite right ;-)
Callbacks are normally processed in the context of the component that
defines them (the owner). In the code below you directly call a
foreign rendering method:
html div: [html anchor
onClick: (html updater
id: TheTabTestPanel id;
callback: [:r |
TheTabTestPanel add: (SUCounterTest new) label: 'another'.
TheTabTestPanel renderBodyOn: r]);
with: 'AJAX add from nested SUCounter'.].
Then the problem is that the owner of all callbacks in your tab panel
is the SUCounter that just disappeared. And there is nobody that takes
care of these callbacks. Bummer.
Seaside 2.9 already takes a step in the direction of fixing that kind
of problems. It supports so called 'homeless callbacks' that can be
incredibly useful when you want define a callback from a file-library
(or something else that is not the callback processing chain). I guess
this solution could be applied to this problem as well and would solve
many sleepless nights. Thanks for providing such a nice example to
reproduce this problem.
> (I mainly want to understand the right way ... but also worry about scale:
> does the total size of the component tree matter, or just the size of
> #children of any one node?)
This is usually not a problem, if you have a moderate number of children.
> > - when a tab panel is removed, also update the tab panel
> > - avoid throwing an error when the same tab panel is close twice
> > - removed unknown message-send from #selected (Sophie probably wants
> > to skip this step)
Pay attention to use the right renderer. Even if it mostly works, I
just noticed that there are some places where you use html within an
More information about the seaside