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

John Thornborrow john at pinesoft.co.uk
Mon Apr 28 10:07:22 UTC 2008


Hi,

#call: should only be used in a callback, or when using a WATask 
subclass. (The latter leaves you no option anyway, as WATasks cannot/do 
not render)

If you want multiple components rendered on the same page, you must use 
#render:, if you want to pass control of the session to another 
component, use #call: within a callback.

It is also worth noting the #onAnswer: message, this allows you to 
render multiple components and ensure all will do specific action upon 
answering. An example:

MyTask>>go
   self call: MyParentComponent new

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


The block(s) sent to the child components will ensure that when they 
#answer:, the parent component will #answer: the same value.

The above is useful when rendering a menu/navigation component, for example.

Hope this helps,

J.

Edward Stow wrote:
> Hi,
> 
> I have an application that has a body section, the body section can be
> rendered with two or more components.  For example:
> 
> TemplateComponent
>     - HeaderComponent
>     - BodyComponent - one of BodyOne | BodyTwo | etc components.
>     - FooterComponent
> 
> 
> This question may be exposing my ignorance .... but I see two ways to
> 'paint' my page with components in response to user interaction with
> my application.
> 
> 1.  #render:  During the renderContentOn phase arrange for the
> component (BodyOne | BodyTwo) to be #render:ed.
> 
> 2.  #call: During the action phase arrange for the component (BodyOne
> | BodyTwo) to be called from the current body component.  The #call:ed
> component does not #answer.
> 
> What would be best practice?
> 
> Should #call: only be used for components that you expect to #answer
> like a DatePicker, ColorChooser etc?
> 
> Thanks

-- 
John Thornborrow
http://www.pinesoft.co.uk


******************************************************************************************************************************************
This email is from Pinesoft Limited. Its contents are confidential to the intended recipient(s) at the email address(es) to which it has been addressed. It may not be disclosed to or used by anyone other than the addressee(s), nor may it be copied in anyway. If received in error, please contact the sender, then delete it from your system. Although this email and attachments are believed to be free of virus, or any other defect which might affect any computer or IT system into which they are received and opened, it is the responsibility of the recipient to ensure that they are virus free and no responsibility is accepted by Pinesoft for any loss or damage arising in any way from receipt or use thereof. *******************************************************************************************************************************************


Pinesoft Limited are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA


More information about the seaside mailing list