[Seaside] #render: or #call: components.

Lukas Renggli renggli at gmail.com
Mon Apr 28 10:41:16 UTC 2008


>  MyParentComponent>>renderContentOn: html
>   html render: (
>     ChildComponentA new
>       onAnswer: [ :val | self answer: val ];
>       yourself).
>   html render: (
>     ChildComponentB new
>       onAnswer: [ :val | self answer: val];
>       yourself)

No component instantiation in the render method! Like this you get new
components every time you hit refresh or perform an action on the
page. This certainly does not work as expected.

You probably want something like this:

MyPageComponent>>initialize
    super initialize.
    childA := ChildComponentA new
       onAnswer: [ :val | self answer: val ];
       yourself.
    childB := ChildComponentB new
       onAnswer: [ :val | self answer: val ];
       yourself.

MyPageComponent>>children
    ^ Array with: childA with: childB

MyPageComponent>>renderContentOn: html
    html render: childA.
    html render: childB

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list