Properties Methods Events Config Options Direct Link

    ContainerLayout
      TableLayout

# Class Ext.layout.TableLayout

Package: | Ext.layout
Defined In: | TableLayout.js
Class: | TableLayout
Extends: | ContainerLayout

This layout allows you to easily render content into an HTML table. The total number of columns can be specified, and rowspan and colspan can be used to create complex layouts within the table. This class is intended to be extended or created via the layout:'table' Ext.Container.layout config, and should generally not need to be created directly via the new keyword.

Note that when creating a layout via config, the layout-specific config properties must be passed in via the Ext.Container.layoutConfig object which will then be applied internally to the layout. In the case of TableLayout, the only valid layout config property is columns. However, the items added to a TableLayout can supply the following table-specific config properties:

- rowspan Applied to the table cell containing the item.
- colspan Applied to the table cell containing the item.
- cellId An id applied to the table cell containing the item.
- cellCls A CSS class name added to the table cell containing the item.

The basic concept of building up a TableLayout is conceptually very similar to building up a standard HTML table. You simply add each panel (or "cell") that you want to include along with any span attributes specified as the special config properties of rowspan and colspan which work exactly like their HTML counterparts. Rather than explicitly creating and nesting rows and columns as you would in HTML, you simply specify the total column count in the layoutConfig and start adding panels in their natural order from left to right, top to bottom. The layout will automatically figure out, based on the column count, rowspans and colspans, how to position each panel within the table. Just like with HTML tables, your rowspans and colspans must add up correctly in your overall layout or you'll end up with missing and/or extra cells! Example usage:

    // This code will generate a layout table that is 3 columns by 2 rows
    // with some spanning included.  The basic layout will be:
    // +--------+-----------------+
    // |   A    |   B             |
    // |        |--------+--------|
    // |        |   C    |   D    |
    // +--------+--------+--------+
    var table = new Ext.Panel({
        title: 'Table Layout',
        layout:'table',
        defaults: {
            // applied to each contained panel
            bodyStyle:'padding:20px'
        },
        layoutConfig: {
            // The total column count must be specified here
            columns: 3
        },
        items: [{
            html: '<p>Cell A content</p>',
            rowspan: 2
        },{
            html: '<p>Cell B content</p>',
            colspan: 2
        },{
            html: '<p>Cell C content</p>',
            cellCls: 'highlight'
        },{
            html: '<p>Cell D content</p>'
        }]
    });

## Config Options

Config Options | Defined By
--- | ---
| columns : Number The total number of columns to create in the table for this layout. If not specified, all Components added to this l... The total number of columns to create in the table for this layout. If not specified, all Components added to this layout will be rendered into a single row using one column per Component. | TableLayout
| extraCls : String An optional extra CSS class that will be added to the container. This can be useful for adding customized styles to t... An optional extra CSS class that will be added to the container. This can be useful for adding customized styles to the container or any of its children using standard CSS rules. See Ext.Component.ctCls also. Note: `extraCls` defaults to `''` except for the following classes which assign a value by default: Absolute Layout : `'x-abs-layout-item'` Box Layout : `'x-box-item'` Column Layout : `'x-column'` To configure the above Classes with an extra CSS class append to the default. For example, for ColumnLayout:
    extraCls: 'x-column custom-class'
| ContainerLayout
| renderHidden : Boolean True to hide each contained item on render (defaults to false). | ContainerLayout
| tableAttrs : Object An object containing properties which are added to the DomHelper specification used to create the layout's &lt;table&... An object containing properties which are added to the DomHelper specification used to create the layout's `<table>` element. Example:
    {
        xtype: 'panel',
        layout: 'table',
        layoutConfig: {
            tableAttrs: {
                style: {
                    width: '100%'
                }
            },
            columns: 3
        }
    }
| TableLayout

## Public Properties

Property | Defined By
--- | ---
| fieldTpl : Ext.Template The Ext.Template used by Field rendering layout classes (such as Ext.layout.FormLayout) to create the DOM structure o... The Ext.Template used by Field rendering layout classes (such as Ext.layout.FormLayout) to create the DOM structure of a fully wrapped, labeled and styled form Field. A default Template is supplied, but this may be overriden to create custom field structures. The template processes values returned from Ext.layout.FormLayout.getTemplateArgs. | ContainerLayout
| if : Object This monitorResize flag will be renamed soon as to avoid confusion with the Container version which hooks onWindowRes... This monitorResize flag will be renamed soon as to avoid confusion with the Container version which hooks onWindowResize to doLayout monitorResize flag in this context attaches the resize event between a container and it's layout | ContainerLayout

## Public Methods

Method | Defined By
--- | ---
| parseMargins( `Number|String v` ) : Object Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations (e.g. 10, ... Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations (e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result) Parameters: `v` : Number|String The encoded margins Returns: `Object` An object with margin sizes for top, right, bottom and left | ContainerLayout

## Public Events

This class has no public events.