[Seaside] WAAsyncHtmlRenderer and CSS

Michel Bany michel.bany at gmail.com
Thu Apr 5 19:59:40 UTC 2007

On 10 Apr 2007, at 12:25 , Sebastian Heidbrink wrote:

> Hi,
> I'm using Squeak 3.9 and Seaside 2.7.
> On my site I have a mainframe including header, menues and a  
> subframe with content.
> The mainframe has WARenderCanvas as rendererClass.
> One of my subframes needs to be updated several times. Therefore I  
> decided to use the SeasideAsync package and set the rendererClass  
> to WAAsyncHtmlRenderer.

Hi Sebastian,

Try using WAAsyncRenderCanvas rather than WAAsyncHtmlRenderer. The  
former is for the canvas api, the later is for the older api.
Since you are using the canvas api for your main frame, you should  
also use the canvas api for your async components.

> Two problems appear.
> First, the content of the AsyncSubframe is only shown when its  
> registered as application and shown as a single site without my  
> mainframe. Embedded in the mainframe it doesn't appear.

It should work, did you add the Async library (WAAsyncScripts) to the  
mainframe ?
Alternatively you can also use WAAsyncComponent as the superclass for  
your mainframe component.

> Second, everytime the AsyncSubframe ist rerendered, I want to  
> change the cssStyleSheet. Therefore my asyncDiv looks like that:
> "renderContentOn: html
> html divNamed: 'XY' with:[:event: h | self updateSomething.
>                                                     h style: self  
> updatedCssStyleSheet.
>                                                     self  
> renderTheNewContentOn: h] every: 5 seconds."

With the WAAsyncRenderCanvas this would become something like this

	html div
			id: 'XY';
			refreshWith: [:event :h | ... ] every: 5 seconds.
> I tested the updatedCssStyleSheet-thing with a non-async- 
> rendererClass and the contents was shown in the Css-Viewer of the  
> webframework and the site works fine. But using it async it isn't.
> It works but position information isn't recognized properly.
> Inside of updatedCssStyleSheet there are 'position: absolute'-Css- 
> desciptions and the needed 'position: relative'-Css-desciptions is  
> declared in an 'XY'-enclosing div-tag but the position information  
> is ignored. As I said, it works static, but periodic it doesn't.
> Is there any other posibillity to change the style periodic?

No, this will not work. The async javascript does not process the  
<style> elements that you include in a live callback.
You should rather play with css class instead and add the  
corresponding selectors to your main style sheet.

	html div
			id: 'XY';
			refreshWith: [:event :h | ...
					h div class: 'periodic'; with: [self renderTheNewContentOn: h] ]  
every: 5 seconds.

As a side note, the async javascript does process the <script>  
elements that you include in the live callbacks.

> And one more question.
> Porting a site from not-async to async is a little circumstantial.  
> Why is there a different naming for things meaning merely the same?  
> div id: ; with: and divNamed: with:, for example.

If you use WAAsyncRenderCanvas rather than WAAsyncHtmlRenderer things  
will look consistent.

> Ah. And one more thing. I couldn't load Seaside 2.8a with  
> SeasideAsync. Will there be any changes in future?

SeasideAsync supports Seaside 2.6 and 2.7 and has not yet been  
updated for 2.8.


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

More information about the Seaside mailing list