On Wed, Oct 17, 2012 at 9:45 AM, Paulo Ferreira <[email protected]> wrote:

> Hi,
>
> I've come across a strange situation.
>
> I wanted to create a Table with a Text Field in the Column Header and
> came across the following piece of code in qooxdoo 2.0.2.
>
> In the init member "qx.ui.table.columnmodel.Basic", I found the
> following piece of code:
>
> var headerRenderer = this.__headerRenderer ||  (this.__headerRenderer =
> new qx.ui.table.columnmodel.Basic.DEFAULT_HEADER_RENDERER());
>
> Easy enough to understand (i.e. if the __headerRenderer is not set, use
> the default Default Renderer. Okay..
>
> What I don't understand, since I was not able to find any code to the
> contrary, is under what conditions would __headerRenderer would be set?
>

The init() function may be called multiple times. What this line of code is
doing is instantiating a single instance of default header renderer, and
saving a reference to it. When init() is called again, __headerRenderer
will already be set (having been set during the first call to init()), so
the same instance of the default header renderer is used, rather than
instantiating a new one.

Derrell
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to