On 22.03.2012 15:27, Thiago H. de Paula Figueiredo wrote:

>> I thought that onActivate should only be used to initialize data
>> gathered from the activation context and that other intializations
>> should be done in setupRender.
> Have you read this somewhere? I disagree. Any initialization that should  
> be needed in all requests, AJAX or not, can be done in onActivate().

It is possible that I read this somewhere but I cannot recall where.

For me the advantage of this is the strict separation of code:
onActivate handles the activation parameters, setupRender initializes
all data which is needed to display the page and onPrepare handles data
for form display/submission.

Furthermore (if I remember correctly) the justification was that
onActivate is also called when rendering a page link, but I never tested
if this is true.

> For example,  if I'm using a Grid, I usually don't fetch the data for
> it in onActivate() or setupRender(), but in a property which is
> passed directly to the source  parameter.

We have many cases where the get-method would be called multiple times
because we need the value during the whole setupRender process. In this
case we would need to cache the value in the get-method or something
like this. That is why we preferred the initialization at the top of
setupRender().

- Stephan

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to