PDA

View Full Version : onRender vs. Constructor



bigmountainben
21 Apr 2009, 9:03 PM
Hi everyone,

For say, a LayoutContainer subclass, what are the guidelines with respect to overriding onRender vs. doing most of the work in the constructor and letting the super class onRender do the work?

Thanks!
Ben

dardison
23 Apr 2009, 8:23 AM
I think the best reason for override onRender is lazy loading. I mean, you will build widgets a second before you need it, if you did in constructor you will have the objects earlier than it was expected.

bigmountainben
23 Apr 2009, 12:57 PM
Hey, thanks for the reply.

How often is onRender called? Is everytime the page is loaded? or more often?

It seems like a good model is to do data retrieval in the constructor, and widget creation in onRender. Any thoughts on that?

Thanks,
Ben

sven
23 Apr 2009, 1:00 PM
onRender is called once.