[Seaside] how call onLoad() script

Karsten Kusche karsten at heeg.de
Thu Jul 4 14:39:33 UTC 2013


Sabine,

as you're using jQuery, you shouldn't need to use onLoad(). Instead use the jQuery function like so:

jQuery(function(){
// on load code here
});

The function that's passed as parameter to jQuery() is executed when the page is ready (like onLoad) or when you load more html, then it's executed when that html is ready.

In Seaside you can use the html-document's #addLoadScript: method, which will call the jQuery function as long as you use the JQScriptGenerator. See WAWelcome class>>initialize on how to tell your application to use that script generator.

To add a load script, do something like:
 html document addLoadScript: (…)
or   
 html div script: (..).
The later can be a bit tricky though as it overrides the script's ID.

Kind Regards
Karsten


--  
Karsten Kusche - Dipl. Inf. (FH) - karsten at heeg.de
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812  


Am Donnerstag, 4. Juli 2013 um 16:00 schrieb Sabine Knöfel:

> Hi
>  
> I use JQUILayout.
> (In my app, on the left is a menu, in the center different pages depending
> on the menu selection).
>  
> For opening a certain page in the center, after clicking in the menu, I make
> something like:
>  
> html << (html jQuery: #center) html: theView.
>  
> This opens and renders the page -> ok.
>  
> But it does not perform the onLoad() script of theView.
>  
> If I force the same page to reload, the onLoad() (Stg+F5), then fires.
>  
> I think I should send something to theView and need a hint for this.
> Sabine
>  
>  
>  
> --
> View this message in context: http://forum.world.st/how-call-onLoad-script-tp4697350.html
> Sent from the Seaside General mailing list archive at Nabble.com (http://Nabble.com).
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org (mailto:seaside at lists.squeakfoundation.org)
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20130704/08833333/attachment.htm


More information about the seaside mailing list