« Return to Thread: #render: or #call: components.

Re: #render: or #call: components.

by Lukas Renggli :: Rate this Message:

Reply to Author | View in Thread

>  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
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

 « Return to Thread: #render: or #call: components.