[Seaside] generating callback from ajax

Milan Mimica milan.mimica at gmail.com
Sat Sep 17 14:31:41 UTC 2011

I know I'm not supposed to reuse the canvas provided by
"WAComponent>>renderContentOn: html", but I am resusing it to generate
callbacks in ajax responses.
Something like this:
MyComponent>>renderContentOn: html
canvas := html.
... rendering ...
... registering callback ...

| url |
  url := canvas actionUrl copy
		addField: (canvas callbacks store: (JSAjaxCallback on: [...]));
    self requestContext respond: [ :ret |
		ret	doNotCache;
			contentType: (WAMimeType applicationJson
				charset: self requestContext handler charSet).
		url asString jsonOn: ret stream].

It works. The question is: Is it bad?

Milan Mimica

More information about the seaside mailing list