[Seaside] Checkbox and AJAX?

Johan Brichau johan at inceptive.be
Sun Jul 6 12:14:54 UTC 2014


Both in the context of the #script: ajax callback-to-smalltalk and the ajax #onSuccess: javascript-callback option, the javascript's this variable will not hold anything related to the DOM.

The difference between #script: and #onSuccess: is that the former defines a script rendering callback to be executed in Seaside and the latter is a jQuery ajax option to define a javascript callback (to be executed client-side) when the ajax call finishes successfully. 

The onSuccess parameter will accept both a string or a JSScript instance as a Javascript to be executed
In a #script callback, the block argument is a JSScript instance already. The script concatenation operator '<<' expects another JSScript instance (e.g. a JSStream instance). If you concatenate a Smalltalk string with a JSScript instance, the Smalltalk string is serialized as a Javascript string on the JSScript instance.


On 06 Jul 2014, at 01:06, carlo.t <snoobabk at yahoo.ie> wrote:

> Hi
> I thick #script: does not work because this is a separate ajax call where
> the reference to 'this' is not known and is not the row you expect.
> #script would work if you reference a valid DOM id for the row e.g.
> 					html checkbox
> 						onClick: (html jQuery ajax serializeThisWithHidden;
> 								script: [:s | s
> 										<< (s jQuery: #idForRow) addClass: 'selectedRow']);
> #onSuccess is probably triggering a callback where the reference to 'this'
> is valid and so the following line will work:
> 	(html jQuery this closest: 'tr') addClass: 'selectedRow'
> I'm a javascript newbie too but thats what I think is going on.
> Cheers
> Carlo
> --
> View this message in context: http://forum.world.st/Checkbox-and-AJAX-tp4731692p4766717.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the seaside mailing list