[Seaside] Ajax delete component only works if #children still report all previously deleted components?

Lukas Renggli renggli at gmail.com
Sun Feb 17 09:26:06 UTC 2008

Again this is exactly the same problem as we have seen before:

- Callbacks have an owner, that is set when defining the components.
When you directly call an internal rendering method of a different
component (and you do this in your updater) you violate this contract
(see the class comment of WAComponent).
- Callbacks for a particular owner are only processed if the owner is
in the component tree.

As I already said many times: If you want to have it easy, don't mix
components and AJAX. In your code for example, the subclass C doesn't
use any functionality of its superclass WAComponent (with the
exception that it can be registered as root).

Otherwise you might want try adding the following method:

WARenderCanvas>>in: aComponent do: aBlock
	| previous |
	previous := callbacks.
	callbacks := context callbacksFor: aComponent.
	self render: aBlock.
	callbacks := previous

Then change all your rendering code from AJAX callbacks to something along:

	callback: [ : r |
		self subs add: (C new parent: self).
		r in: self do: [ self basicRenderOn: r ] ]) ;


	callback: [ : r |
		parent subs remove: self.
		parent deleted add: self.
		r in: parent do: [ parent basicRenderOn: r ] ]) ;

> Longer term would this be helped by a clearer separation of different Ajax
> callbacks phases for (a) domain model update, then (b) component tree update
> + re-rendering?

There is just one AJAX callback phase.


Lukas Renggli

More information about the seaside mailing list