Component

Overview

Component is the base class for all GXT widgets. Component is a Widget subclass that introduces several new features and concepts to standard GWT widgets.

Lazy Rendering

Components are rendered lazily. This means that the component's DOM elements are not created when the component is first instantiated, rather created when the component is rendered.

Rendering occurs when the render method is called on a component. The render method expects both a target element and the index at which the component should be rendered. This is quite different than in GWT. In GWT, a widget's DOM is created when the widget is created and is complete before the widget has been added to the panel. Rendering a component lazily and with a parent element provides several advantages:

So when is a component rendered? Rendering occurs at 2 different times. First, if a Component is added to a GWT Panel, it is rendered at that time. Second, if a Component is added to a GXT Container, it is rendered by the Container.

El Object

Each component, has a El instance which provides access to many DOM related functions. This instance can be accessed using the el() method. It is important to note that the El instance is only available after the component has been rendered. This makes sense, as a El instance wraps a DOM element, and a component's DOM structure is not created until the component is rendered.