View Full Version : OnRender and constructor

6 Dec 2010, 11:06 AM
Maybe itīs a so basic question, but I hadnīt realized of this until now.
When I create a new widget which extends a LayoutContainer or a ContentPanel, etc, sometimes I defined a new constructor, sometimes override the onRender method. Both cases it seems to work right, but I know Iīm not doing it as it should be done; because I suppouse each method has it pourpouse. So, can anyone explain me the differences between using one method or the other one? Or at least, what onRender should be used for and what the constructor should be used for


6 Dec 2010, 11:11 AM
Both work fine. Its up to you where you want to do it. onRender gets only called with the component gets really used. So if you create extra objects, they are only created when the component gets rendered.

16 Nov 2011, 9:27 PM
Basically GXT suggest us to extend super class overriding the onRender() method.
it is for lazy rendering.
and on constructor is also ok, just not follow the GXT standard, I thought.
both ways are work well.