[Seaside] generating callback from ajax

Milan Mimica milan.mimica at gmail.com
Sat Sep 17 17:23:12 UTC 2011

On 17 September 2011 18:13, Johan Brichau <johan at inceptive.be> wrote:
> How are you registering the callback that will that call the #ajaxCallback method?
> I'm asking because I see no reason to have such a construction. If you are registering an ajax callback that is supposed to render something (html, script, json, …) Seaside provides you with an appropriate renderContext. In all kinds of callbacks, you can therefore access the callbacks dictionary without needing to 'reuse' an old canvas / rendercontext.

I'm registering like this:
rendererContext := html.
dataUrl := rendererContext actionUrl copy
		addField: (rendererContext callbacks
							store: (JSAjaxCallback on: [ self ajaxCallback ]));

And then inside ajaxCallback I want to register another callback and
respond the url of it :)

Why am I doing this? Well, trying to make best of jqGrid.
I want a separate callback for each row, when edited. I am storing the
callback url with the row data, in a hidden column, so the client
knows where to report edits for each row.  jqGrid obtains rows using a
AJAX request. Hence I need to register a callback for each row
returned to jqGrid in that AJAX request.

I could register a callback for each row in advance, but there is a
lot of rows and jqGrid does pagination... so that's not the way to go.
Hm... maybe I could preregister a few dozen of callbacks when
rendering and then in the callback just assign them to rows... could
work, but it's ugly.

Milan Mimica

More information about the seaside mailing list