Class type Ext_AbstractComponent.configs


class type configs = object .. end
Inherits
method autoEl : 'a. 'a Js.t Js.prop

A tag name or DomHelper spec used to create the Element which will encapsulate this Component.

You do not normally need to specify this. For the base classes Ext.Component and Ext.container.Container, this defaults to 'div'. The more complex Sencha classes use a more complex DOM structure specified by their own renderTpls.

This is intended to allow the developer to create application-specific utility Components encapsulated by different DOM elements. Example usage:

{
    xtype: 'component',
    autoEl: {
        tag: 'img',
        src: 'http://www.example.com/example.jpg'
    }
}, {
    xtype: 'component',
    autoEl: {
        tag: 'blockquote',
        html: 'autoEl is cool!'
    }
}, {
    xtype: 'container',
    autoEl: 'ul',
    cls: 'ux-unordered-list',
    items: {
        xtype: 'component',
        autoEl: 'li',
        html: 'First list item'
    }
}

method autoRender : 'b. 'b Js.t Js.prop

This config is intended mainly for non-floating Components which may or may not be shown. Instead of using renderTo in the configuration, and rendering upon construction, this allows a Component to render itself upon first show. If floating is true, the value of this config is omitted as if it is true.

Specify as true to have this Component render to the document body upon first show.

Specify as an element, or the ID of an element to have this Component render to a specific element upon first show.

Defaults to: false

method autoShow : bool Js.t Js.prop

true to automatically show the component upon creation. This config option may only be used for floating components or components that use autoRender.

Defaults to: false

method baseCls : Js.js_string Js.t Js.prop

The base CSS class to apply to this component's element. This will also be prepended to elements within this component like Panel's body will get a class x-panel-body. This means that if you create a subclass of Panel, and you want it to get all the Panels styling for the element and the body, you leave the baseCls x-panel and use componentCls to add specific styling for this component.

Defaults to: 'x-component'

method border : 'c. 'c Js.t Js.prop

Specifies the border size for this component. The border can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example: '10 5 3 10' (top, right, bottom, left).

For components that have no border by default, setting this won't make the border appear by itself. You also need to specify border color and style:

border: 5,
style: {
    borderColor: 'red',
    borderStyle: 'solid'
}

To turn off the border, use border: false.


method childEls : 'd. 'd Js.t Js.js_array Js.t Js.prop

An array describing the child elements of the Component. Each member of the array is an object with these properties:

If the array member is a string, it is equivalent to { name: m, itemId: m }.

For example, a Component which renders a title and body text:

Ext.create('Ext.Component', {
    renderTo: Ext.getBody(),
    renderTpl: [
        '<h1 id="{id}-title">{title}</h1>',
        '<p>{msg}</p>',
    ],
    renderData: {
        title: "Error",
        msg: "Something went wrong"
    },
    childEls: ["title"],
    listeners: {
        afterrender: function(cmp){
            // After rendering the component will have a title property
            cmp.title.setStyle({color: "red"});
        }
    }
});

A more flexible, but somewhat slower, approach is renderSelectors.


method cls : Js.js_string Js.t Js.prop

An optional extra CSS class that will be added to this component's Element. This can be useful for adding customized styles to the component or any of its children using standard CSS rules.

Defaults to: ''

method componentCls : Js.js_string Js.t Js.prop

CSS Class to be added to a components root level element to give distinction to it via styling.


method componentLayout : 'e. 'e Js.t Js.prop

The sizing and positioning of a Component's internal Elements is the responsibility of the Component's layout manager which sizes a Component's internal structure in response to the Component being sized.

Generally, developers will not use this configuration as all provided Components which need their internal elements sizing (Such as input fields) come with their own componentLayout managers.

The default layout manager will be used on instances of the base Ext.Component class which simply sizes the Component's encapsulating element to the height and width specified in the setSize method.


method contentEl : Js.js_string Js.t Js.prop

Specify an existing HTML element, or the id of an existing HTML element to use as the content for this component.

This config option is used to take an existing HTML element and place it in the layout element of a new component (it simply moves the specified DOM element after the Component is rendered to use as the content.

Notes:

The specified HTML element is appended to the layout element of the component after any configured HTML has been inserted, and so the document will not contain this element at the time the render event is fired.

The specified HTML element used will not participate in any layout scheme that the Component may use. It is just HTML. Layouts operate on child items.

Add either the x-hidden or the x-hide-display CSS class to prevent a brief flicker of the content before it is rendered to the panel.


method data : 'f. 'f Js.t Js.prop

The initial set of data to apply to the tpl to update the content area of the Component.


method disabled : bool Js.t Js.prop

true to disable the component.

Defaults to: false

method disabledCls : Js.js_string Js.t Js.prop

CSS class to add when the Component is disabled.

Defaults to: 'x-item-disabled'

method draggable : bool Js.t Js.prop

Allows the component to be dragged.

Defaults to: false

method floating : bool Js.t Js.prop

Create the Component as a floating and use absolute positioning.

The z-index of floating Components is handled by a ZIndexManager. If you simply render a floating Component into the DOM, it will be managed by the global WindowManager.

If you include a floating Component as a child item of a Container, then upon render, Ext JS will seek an ancestor floating Component to house a new ZIndexManager instance to manage its descendant floaters. If no floating ancestor can be found, the global WindowManager will be used.

When a floating Component which has a ZindexManager managing descendant floaters is destroyed, those descendant floaters will also be destroyed.

Defaults to: false

method frame : bool Js.t Js.prop

Specify as true to have the Component inject framing elements within the Component at render time to provide a graphical rounded frame around the Component content.

This is only necessary when running on outdated, or non standard-compliant browsers such as Microsoft's Internet Explorer prior to version 9 which do not support rounded corners natively.

The extra space taken up by this framing is available from the read only property frameSize.


method height : Js.number Js.t Js.prop

The height of this component in pixels.


method hidden : bool Js.t Js.prop

true to hide the component.

Defaults to: false

method hideMode : Js.js_string Js.t Js.prop

A String which specifies how this Component's encapsulating DOM element will be hidden. Values may be:

Defaults to: 'display'

method html : 'g. 'g Js.t Js.prop

An HTML fragment, or a DomHelper specification to use as the layout element content. The HTML content is added after the component is rendered, so the document will not contain this HTML at the time the render event is fired. This content is inserted into the body before any configured contentEl is appended.

Defaults to: ''

method id : Js.js_string Js.t Js.prop

The unique id of this component instance.

It should not be necessary to use this configuration except for singleton objects in your application. Components created with an id may be accessed globally using Ext.getCmp.

Instead of using assigned ids, use the itemId config, and ComponentQuery which provides selector-based searching for Sencha Components analogous to DOM querying. The Container class contains shortcut methods to query its descendant Components by selector.

Note that this id will also be used as the element id for the containing HTML element that is rendered to the page for this component. This allows you to write id-based CSS rules to style the specific instance of this component uniquely, and also to select sub-elements using this component's id as the parent.

Note: To avoid complications imposed by a unique id also see itemId.

Note: To access the container of a Component see ownerCt.

Defaults to an auto-assigned id.


method itemId : Js.js_string Js.t Js.prop

An itemId can be used as an alternative way to get a reference to a component when no object reference is available. Instead of using an id with Ext.getCmp, use itemId with Ext.container.Container.getComponent which will retrieve itemId's or id's. Since itemId's are an index to the container's internal MixedCollection, the itemId is scoped locally to the container -- avoiding potential conflicts with Ext.ComponentManager which requires a unique id.

var c = new Ext.panel.Panel({ //
    height: 300,
    renderTo: document.body,
    layout: 'auto',
    items: [
        {
            itemId: 'p1',
            title: 'Panel 1',
            height: 150
        },
        {
            itemId: 'p2',
            title: 'Panel 2',
            height: 150
        }
    ]
})
p1 = c.getComponent('p1'); // not the same as Ext.getCmp()
p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling

Also see id, Ext.container.Container.query, Ext.container.Container.down and Ext.container.Container.child.

Note: to access the container of an item see ownerCt.


method loader : 'h. 'h Js.t Js.prop

A configuration object or an instance of a Ext.ComponentLoader to load remote content for this Component.

Ext.create('Ext.Component', {
    loader: {
        url: 'content.html',
        autoLoad: true
    },
    renderTo: Ext.getBody()
});

method margin : 'i. 'i Js.t Js.prop

Specifies the margin for this component. The margin can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example: '10 5 3 10' (top, right, bottom, left).


method maxHeight : Js.number Js.t Js.prop

The maximum value in pixels which this Component will set its height to.

Warning: This will override any size management applied by layout managers.


method maxWidth : Js.number Js.t Js.prop

The maximum value in pixels which this Component will set its width to.

Warning: This will override any size management applied by layout managers.


method minHeight : Js.number Js.t Js.prop

The minimum value in pixels which this Component will set its height to.

Warning: This will override any size management applied by layout managers.


method minWidth : Js.number Js.t Js.prop

The minimum value in pixels which this Component will set its width to.

Warning: This will override any size management applied by layout managers.


method overCls : Js.js_string Js.t Js.prop

An optional extra CSS class that will be added to this component's Element when the mouse moves over the Element, and removed when the mouse moves out. This can be useful for adding customized 'active' or 'hover' styles to the component or any of its children using standard CSS rules.

Defaults to: ''

method padding : 'j. 'j Js.t Js.prop

Specifies the padding for this component. The padding can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example: '10 5 3 10' (top, right, bottom, left).


method plugins : 'k. 'k Js.t Js.prop

An array of plugins to be added to this component. Can also be just a single plugin instead of array.

Plugins provide custom functionality for a component. The only requirement for a valid plugin is that it contain an init method that accepts a reference of type Ext.Component. When a component is created, if any plugins are available, the component will call the init method on each plugin, passing a reference to itself. Each plugin can then call methods or respond to events on the component as needed to provide its functionality.

Plugins can be added to component by either directly referencing the plugin instance:

plugins: [Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1})],

By using config object with ptype:

plugins: [{ptype: 'cellediting', clicksToEdit: 1}],

Or with just a ptype:

plugins: ['cellediting', 'gridviewdragdrop'],

See Ext.enums.Plugin for list of all ptypes.


method renderData : 'l. 'l Js.t Js.prop

The data used by renderTpl in addition to the following property values of the component:

See renderSelectors and childEls for usage examples.


method renderSelectors : 'm. 'm Js.t Js.prop

An object containing properties specifying DomQuery selectors which identify child elements created by the render process.

After the Component's internal structure is rendered according to the renderTpl, this object is iterated through, and the found Elements are added as properties to the Component using the renderSelector property name.

For example, a Component which renders a title and description into its element:

Ext.create('Ext.Component', {
    renderTo: Ext.getBody(),
    renderTpl: [
        '<h1 class="title">{title}</h1>',
        '<p>{desc}</p>'
    ],
    renderData: {
        title: "Error",
        desc: "Something went wrong"
    },
    renderSelectors: {
        titleEl: 'h1.title',
        descEl: 'p'
    },
    listeners: {
        afterrender: function(cmp){
            // After rendering the component will have a titleEl and descEl properties
            cmp.titleEl.setStyle({color: "red"});
        }
    }
});

For a faster, but less flexible, alternative that achieves the same end result (properties for child elements on the Component after render), see childEls and addChildEls.


method renderTo : 'n. 'n Js.t Js.prop

Specify the id of the element, a DOM element or an existing Element that this component will be rendered into.

Notes:

Do not use this option if the Component is to be a child item of a Container. It is the responsibility of the Container's layout manager to render and manage its child items.

When using this config, a call to render() is not required.

See also: render.


method renderTpl : 'o. 'o Js.t Js.prop

An XTemplate used to create the internal structure inside this Component's encapsulating Element.

You do not normally need to specify this. For the base classes Ext.Component and Ext.container.Container, this defaults to null which means that they will be initially rendered with no internal structure; they render their Element empty. The more specialized Ext JS and Sencha Touch classes which use a more complex DOM structure, provide their own template definitions.

This is intended to allow the developer to create application-specific utility Components with customized internal structure.

Upon rendering, any created child elements may be automatically imported into object properties using the renderSelectors and childEls options.

Defaults to: '{%this.renderContent(out,values)%}'

method rtl : bool Js.t Js.prop

True to layout this component and its descendants in "rtl" (right-to-left) mode. Can be explicitly set to false to override a true value inherited from an ancestor.

Defined in override Ext.rtl.AbstractComponent.


method shrinkWrap : 'p. 'p Js.t Js.prop

If this property is a number, it is interpreted as follows:

In CSS terms, shrink-wrap width is analogous to an inline-block element as opposed to a block-level element. Some container layouts always shrink-wrap their children, effectively ignoring this property (e.g., Ext.layout.container.HBox, Ext.layout.container.VBox, Ext.layout.component.Dock).

Defaults to: 2

method style : 'q. 'q Js.t Js.prop

A custom style specification to be applied to this component's Element. Should be a valid argument to Ext.Element.applyStyles.

new Ext.panel.Panel({
    title: 'Some Title',
    renderTo: Ext.getBody(),
    width: 400, height: 300,
    layout: 'form',
    items: [{
        xtype: 'textarea',
        style: {
            width: '95%',
            marginBottom: '10px'
        }
    },
    new Ext.button.Button({
        text: 'Send',
        minWidth: '100',
        style: {
            marginBottom: '10px'
        }
    })
    ]
});

method tpl : 'r. 'r Js.t Js.prop

An Ext.Template, Ext.XTemplate or an array of strings to form an Ext.XTemplate. Used in conjunction with the data and tplWriteMode configurations.


method tplWriteMode : Js.js_string Js.t Js.prop

The Ext.(X)Template method to use when updating the content area of the Component. See Ext.XTemplate.overwrite for information on default mode.

Defaults to: 'overwrite'

method ui : Js.js_string Js.t Js.prop

A UI style for a component.

Defaults to: 'default'

method width : Js.number Js.t Js.prop

The width of this component in pixels.


method xtype : Js.js_string Js.t Js.prop

This property provides a shorter alternative to creating objects than using a full class name. Using xtype is the most common way to define component instances, especially in a container. For example, the items in a form containing text fields could be created explicitly like so:

 items: [
     Ext.create('Ext.form.field.Text', {
         fieldLabel: 'Foo'
     }),
     Ext.create('Ext.form.field.Text', {
         fieldLabel: 'Bar'
     }),
     Ext.create('Ext.form.field.Number', {
         fieldLabel: 'Num'
     })
 ]

But by using xtype, the above becomes:

 items: [
     {
         xtype: 'textfield',
         fieldLabel: 'Foo'
     },
     {
         xtype: 'textfield',
         fieldLabel: 'Bar'
     },
     {
         xtype: 'numberfield',
         fieldLabel: 'Num'
     }
 ]

When the xtype is common to many items, Ext.container.AbstractContainer.defaultType is another way to specify the xtype for all items that don't have an explicit xtype:

 defaultType: 'textfield',
 items: [
     { fieldLabel: 'Foo' },
     { fieldLabel: 'Bar' },
     { fieldLabel: 'Num', xtype: 'numberfield' }
 ]

Each member of the items array is now just a "configuration object". These objects are used to create and configure component instances. A configuration object can be manually used to instantiate a component using Ext.widget:

 var text1 = Ext.create('Ext.form.field.Text', {
     fieldLabel: 'Foo'
 });

 // or alternatively:

 var text1 = Ext.widget({
     xtype: 'textfield',
     fieldLabel: 'Foo'
 });

This conversion of configuration objects into instantiated components is done when a container is created as part of its {Ext.container.AbstractContainer.initComponent} process. As part of the same process, the items array is converted from its raw array form into a Ext.util.MixedCollection instance.

You can define your own xtype on a custom component by specifying the xtype property in Ext.define. For example:

Ext.define('MyApp.PressMeButton', {
    extend: 'Ext.button.Button',
    xtype: 'pressmebutton',
    text: 'Press Me'
});

Care should be taken when naming an xtype in a custom component because there is a single, shared scope for all xtypes. Third part components should consider using a prefix to avoid collisions.

Ext.define('Foo.form.CoolButton', {
    extend: 'Ext.button.Button',
    xtype: 'ux-coolbutton',
    text: 'Cool!'
});

See Ext.enums.Widget for list of all available xtypes.


method afterComponentLayout : 's 't.
((< afterComponentLayout : 's 't. 'u;
afterRender : ('v Js.t, unit -> unit) Js.meth_callback
Js.writeonly_prop;
afterSetPosition : ('v Js.t, Js.number Js.t -> Js.number Js.t -> unit)
Js.meth_callback Js.writeonly_prop;
autoEl : 'a. 'a Js.t Js.prop; autoRender : 'b. 'b Js.t Js.prop;
autoShow : bool Js.t Js.prop; baseCls : Js.js_string Js.t Js.prop;
beforeComponentLayout : ('v Js.t,
Js.number Js.t -> Js.number Js.t -> unit)
Js.meth_callback Js.writeonly_prop;
beforeDestroy : ('v Js.t, unit -> unit) Js.meth_callback
Js.writeonly_prop;
beforeLayout : ('v Js.t, unit -> unit) Js.meth_callback
Js.writeonly_prop;
border : 'c. 'c Js.t Js.prop;
childEls : 'd. 'd Js.t Js.js_array Js.t Js.prop;
cls : Js.js_string Js.t Js.prop;
componentCls : Js.js_string Js.t Js.prop;
componentLayout : 'e. 'e Js.t Js.prop;
contentEl : Js.js_string Js.t Js.prop; data : 'f. 'f Js.t Js.prop;
disabled : bool Js.t Js.prop; disabledCls : Js.js_string Js.t Js.prop;
draggable : bool Js.t Js.prop; floating : bool Js.t Js.prop;
frame : bool Js.t Js.prop; height : Js.number Js.t Js.prop;
hidden : bool Js.t Js.prop; hideMode : Js.js_string Js.t Js.prop;
html : 'g. 'g Js.t Js.prop; id : Js.js_string Js.t Js.prop;
itemId : Js.js_string Js.t Js.prop; listeners : 'w. 'w Js.t Js.prop;
loader : 'h. 'h Js.t Js.prop; margin : 'i. 'i Js.t Js.prop;
maxHeight : Js.number Js.t Js.prop; maxWidth : Js.number Js.t Js.prop;
minHeight : Js.number Js.t Js.prop; minWidth : Js.number Js.t Js.prop;
onAdded : 'x.
('v Js.t, 'x Js.t -> Js.number Js.t -> unit)
Js.meth_callback Js.writeonly_prop;
onDisable : ('v Js.t, unit -> unit) Js.meth_callback Js.writeonly_prop;
onEnable : ('v Js.t, unit -> unit) Js.meth_callback Js.writeonly_prop;
onPosition : ('v Js.t, Js.number Js.t -> Js.number Js.t -> unit)
Js.meth_callback Js.writeonly_prop;
onRemoved : ('v Js.t, bool Js.t -> unit) Js.meth_callback
Js.writeonly_prop;
onRender : ('v Js.t, Ext_dom_Element.t Js.t -> Js.number Js.t -> unit)
Js.meth_callback Js.writeonly_prop;
onResize : 'y 'z 'a1 'b1.
('v Js.t,
'y Js.t -> 'z Js.t -> 'a1 Js.t -> 'b1 Js.t -> unit)
Js.meth_callback Js.writeonly_prop;
overCls : Js.js_string Js.t Js.prop; padding : 'j. 'j Js.t Js.prop;
plugins : 'k. 'k Js.t Js.prop; renderData : 'l. 'l Js.t Js.prop;
renderSelectors : 'm. 'm Js.t Js.prop; renderTo : 'n. 'n Js.t Js.prop;
renderTpl : 'o. 'o Js.t Js.prop; rtl : bool Js.t Js.prop;
saveDelay : Js.number Js.t Js.prop; shrinkWrap : 'p. 'p Js.t Js.prop;
stateEvents : Js.js_string Js.t Js.js_array Js.t Js.prop;
stateId : Js.js_string Js.t Js.prop; stateful : bool Js.t Js.prop;
style : 'q. 'q Js.t Js.prop; tpl : 'r. 'r Js.t Js.prop;
tplWriteMode : Js.js_string Js.t Js.prop;
ui : Js.js_string Js.t Js.prop; width : Js.number Js.t Js.prop;
xtype : Js.js_string Js.t Js.prop; .. >
as 'v)
Js.t, Js.number Js.t -> Js.number Js.t -> 's Js.t -> 't Js.t -> unit)
Js.meth_callback Js.writeonly_prop as 'u
See method t.afterComponentLayout
method afterSetPosition : ('v Js.t, Js.number Js.t -> Js.number Js.t -> unit) Js.meth_callback
Js.writeonly_prop
See method t.afterSetPosition
method beforeComponentLayout : ('v Js.t, Js.number Js.t -> Js.number Js.t -> unit) Js.meth_callback
Js.writeonly_prop
See method t.beforeComponentLayout
method beforeDestroy : ('v Js.t, unit -> unit) Js.meth_callback Js.writeonly_prop
See method t.beforeDestroy
method beforeLayout : ('v Js.t, unit -> unit) Js.meth_callback Js.writeonly_prop
See method t.beforeLayout
method onAdded : 'x.
('v Js.t, 'x Js.t -> Js.number Js.t -> unit) Js.meth_callback
Js.writeonly_prop
See method t.onAdded
method onDisable : ('v Js.t, unit -> unit) Js.meth_callback Js.writeonly_prop
See method t.onDisable
method onEnable : ('v Js.t, unit -> unit) Js.meth_callback Js.writeonly_prop
See method t.onEnable
method onPosition : ('v Js.t, Js.number Js.t -> Js.number Js.t -> unit) Js.meth_callback
Js.writeonly_prop
See method t.onPosition
method onRemoved : ('v Js.t, bool Js.t -> unit) Js.meth_callback Js.writeonly_prop
See method t.onRemoved
method onResize : 'y 'z 'a1 'b1.
('v Js.t, 'y Js.t -> 'z Js.t -> 'a1 Js.t -> 'b1 Js.t -> unit)
Js.meth_callback Js.writeonly_prop
See method t.onResize