プロパティ メソッド イベント コンフィグオプション ダイレクトリンク
Observable
  Component
    BoxComponent
      Container
        Panel
          GridPanel

Ext.grid.GridPanelクラス

パッケージ:Ext.grid
定義ファイル:GridPanel.js
クラス:Ext.grid.GridPanel
サブクラス:EditorGridPanel
継承元:Panel
xtype:grid

このクラスは、データを列とカラムの表形式のフォーマットで表すように、 コンポーネントベースのGridコントロールの主要なインタフェースを表しています。 GridPanelは次ように構成されます:

  • Store : データレコードを持つモデル(列)
  • Column model : カラムマークアップ
  • View : ユーザインターフェイスをカプセル化します。
  • selection model : セレクション動作

使用例:

var grid = new Ext.grid.GridPanel({
    store: new Ext.data.Store({
        autoDestroy: true,
        reader: reader,
        data: xg.dummyData
    }),
    colModel: new Ext.grid.ColumnModel({
        defaults: {
            width: 120,
            sortable: true
        },
        columns: [
            {id: 'company', header: 'Company', width: 200, sortable: true, dataIndex: 'company'},
            {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
            {header: 'Change', dataIndex: 'change'},
            {header: '% Change', dataIndex: 'pctChange'},
            // renderer: Ext.util.Format.dateRenderer('m/d/Y') を指定する代わりに、 xtypeを使ってください 

            {
                header: 'Last Updated', width: 135, dataIndex: 'lastChange',
                xtype: 'datecolumn', format: 'M d, Y'
            }
        ],
    }),
    viewConfig: {
        forceFit: true,

//      データ値によって列に適用するためにCSSクラスを返してください 

        getRowClass: function(record, index) {
            var c = record.get('change');
            if (c < 0) {
                return 'price-fall';
            } else if (c > 0) {
                return 'price-rise';
            }
        }
    },
    sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
    width: 600,
    height: 300,
    frame: true,
    title: 'Framed with Row Selection and Horizontal Scrolling',
    iconCls: 'icon-grid'
});

メモ:

  • このクラスはベースとなるクラスから、いくつものコンフィグオプションを継承しますが、 いくつかのアイテム(autoScroll、autoWidth、layout、itemsなどのように)はこのクラスでは使用されないので、効果を持ちません。
  • Gridがカラムのスクロール幅を、列のスクロールする高さを必要とします。 寸法はheightwidthオプションによって設定することができます。
    または、Gridのレイアウトマネージャーが、その子アイテム (例えば、Gridの容器がlayout:'fit'を指定するかもしれません )のサイズを設定を提供することで、 コンテナの子アイテムによって設定されることもできます。
  • Gridでデータにアクセスするためには、ストアによってカプセル化されるデータモデルを使用することが必要です。 もっと多くの詳細については、cellclickイベントを見てください。

This class represents the primary interface of a component based grid control to represent data in a tabular format of rows and columns. The GridPanel is composed of the following:

Example usage:

var grid = new Ext.grid.GridPanel({
    store: new Ext.data.Store({
        autoDestroy: true,
        reader: reader,
        data: xg.dummyData
    }),
    colModel: new Ext.grid.ColumnModel({
        defaults: {
            width: 120,
            sortable: true
        },
        columns: [
            {id: 'company', header: 'Company', width: 200, sortable: true, dataIndex: 'company'},
            {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
            {header: 'Change', dataIndex: 'change'},
            {header: '% Change', dataIndex: 'pctChange'},
            // instead of specifying renderer: Ext.util.Format.dateRenderer('m/d/Y') use xtype  

            {
                header: 'Last Updated', width: 135, dataIndex: 'lastChange',
                xtype: 'datecolumn', format: 'M d, Y'
            }
        ],
    }),
    viewConfig: {
        forceFit: true,

//      Return CSS class to apply to rows depending upon data values  

        getRowClass: function(record, index) {
            var c = record.get('change');
            if (c < 0) {
                return 'price-fall';
            } else if (c > 0) {
                return 'price-rise';
            }
        }
    },
    sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
    width: 600,
    height: 300,
    frame: true,
    title: 'Framed with Row Selection and Horizontal Scrolling',
    iconCls: 'icon-grid'
});

Notes:

  • Although this class inherits many configuration options from base classes, some of them (such as autoScroll, autoWidth, layout, items, etc) are not used by this class, and will have no effect.
  • A grid requires a width in which to scroll its columns, and a height in which to scroll its rows. These dimensions can either be set explicitly through the height and width configuration options or implicitly set by using the grid as a child item of a Container which will have a layout manager provide the sizing of its child items (for example the Container of the Grid may specify layout:'fit').
  • To access the data in a Grid, it is necessary to use the data model encapsulated by the Store. See the cellclick event for more details.

コンフィグオプション

コンフィグオプション定義クラス
 allowDomMove : Boolean
コンポーネントをレンダリングする時に、DOMノードの移動を許可するかのフラグです(初期値 false)。
Whether the component can move the Dom node when rendering (defaults to true).
Ext.Component
 autoExpandMax : Number
autoExpandColumnの最大幅を設定します。 初期値は1000です。
The maximum width the autoExpandColumn can have (if enabled). Defaults to 1000.
Ext.grid.GridPanel
 autoExpandMin : Number
autoExpandColumnの最小幅を設定します。 初期値は50です。
The minimum width the autoExpandColumn can have (if enabled). Defaults to 50.
Ext.grid.GridPanel
 cm : Object
colModelの省略形。
Shorthand for colModel.
Ext.grid.GridPanel
 colModel : Object
Gridのレンダリング時に使用するExt.grid.ColumnModelを設定します(必須)。
The Ext.grid.ColumnModel to use when rendering the grid (required).
Ext.grid.GridPanel
 collapsedCls : String
パネルが折りたたまれた後に、エレメントに追加するCSSクラスを設定します(初期値 'x-panel-collapsed')。
A CSS class to add to the panel's element after it has been collapsed (defaults to 'x-panel-collapsed').
Ext.Panel
 columnLines : Boolean
trueに設定した場合、カラムを分離するラインのCSSを追加します。初期値はfalseです。
true to add css for column separation lines. Default is false.
Ext.grid.GridPanel
 ddGroup : String
このGridPanelが属するDDグループを設定します。 設定されない場合、'GridDD'をデフォルト設定とします。
The DD group this GridPanel belongs to. Defaults to 'GridDD' if not specified.
Ext.grid.GridPanel
 disableSelection : Boolean
trueに設定した場合、Gridで選択を無効にします。 初期値はfalseです。 SelectionModelの指定は無視されます。
true to disable selections in the grid. Defaults to false. Ignored if a SelectionModel is specified.
Ext.grid.GridPanel
 disabledClass : String
コンポーネントが無効になったときに、コンポーネント追加されるCSSクラスを設定します(初期値 'x-item-disabled')。
CSS class added to the component when it is disabled (defaults to 'x-item-disabled').
Ext.Component
 enableColumnHide : Boolean
trueに設定した場合、
ヘッダーメニューカラムの非表示を可能にします(初期値 true)。
Defaults to true to enable
hiding of columns with the header menu.
Ext.grid.GridPanel
 enableColumnResize : Boolean
falseに設定した場合、Grid内のすべてのカラムのサイズ変更を無効にします。初期値はtrueです。
false to turn off column resizing for the whole grid. Defaults to true.
Ext.grid.GridPanel
 enableHdMenu : Boolean
trueに設定した場合、ヘッダーのドロップダウンメニューボタンを有効にします(初期値 true)。
Defaults to true to enable the drop down button for menu in the headers.
Ext.grid.GridPanel
 hidden : Boolean
コンポーネントを隠します(初期値 false)。 trueの場合、内部でhideメソッドがコールされます。
Render this component hidden (default is false). If true, the hide method will be called internally.
Ext.Component
 hideHeaders : Boolean
trueに設定した場合、Gridのヘッダーを非表示にします。初期値はfalseです。
True to hide the grid's header. Defaults to false.
Ext.grid.GridPanel
 layoutConfig : Object
もしlayoutオプションを文字列で設定した場合に使用します。
選択されたlayoutのに対してのコンフィグオプションを設定する際に使用します。
This is a config object containing properties specific to the chosen layout if layout has been specified as a string.
Ext.Container
 loadMask : Object
Ext.LoadMaskの設定、または、ロード中にGridにマスクをかける場合はtrueを設定します。 初期値はfalseです。
An Ext.LoadMask config or true to mask the grid while loading. Defaults to false.
Ext.grid.GridPanel
 maxHeight : Number
Gridの高さの最大値を設定します - autoHeightが有効でなければ無視されます。
Sets the maximum height of the grid - ignored if autoHeight is not on.
Ext.grid.GridPanel
 minButtonWidth : Number
このパネル内の最小のボタン幅をピクセルで設定します。(初期値 75)
Minimum width in pixels of all buttons in this panel (defaults to 75)
Ext.Panel
 minColumnWidth : Number
リサイズできるカラムの最小幅を設定します。初期値は25です。
The minimum width a column can be resized to. Defaults to 25.
Ext.grid.GridPanel
 pageX : Number
配置コンテナの中に含まれる場合の、このコンポーネントのページレベルでのx座標を設定します。
The page level x coordinate for this component if contained within a positioning container.
Ext.BoxComponent
 pageY : Number
配置コンテナの中に含まれる場合の、このコンポーネントのページレベルでのy座標を設定します。
The page level y coordinate for this component if contained within a positioning container.
Ext.BoxComponent
 sm : Object
selModelの省略形。
Shorthand for selModel.
Ext.grid.GridPanel
 store : Ext.data.Store
Gridのデータソースとして使用するべきExt.data.Storeを設定します(必須)。
The Ext.data.Store the grid should use as its data source (required).
Ext.grid.GridPanel
 view : Object
Gridによって使用されるExt.grid.GridViewを設定します。 これは、render()がコールされる前に設定できます。
The Ext.grid.GridView used by the grid. This can be set before a call to render().
Ext.grid.GridPanel
 x : Number
配置コンテナの中に含まれる場合の、このコンポーネントのローカルでのx(左)座標を設定します。
The local x (left) coordinate for this component if contained within a positioning container.
Ext.BoxComponent
 y : Number
配置コンテナの中に含まれる場合の、このコンポーネントのローカルでのy(上)座標を設定します。
The local y (top) coordinate for this component if contained within a positioning container.
Ext.BoxComponent

プロパティ

プロパティ定義クラス
 buttons : Array
buttonsコンフィグプロパティから生成されるようなボタンの配列です。 このプロパティは読み取り専用です
This Panel's Array of buttons as created from the buttons config property. Read only.
Ext.Panel
 collapsed : Boolean
パネルが開閉可能な場合、trueが設定されます。このプロパティは読み取り専用です。
True if this panel is collapsed. Read-only.
Ext.Panel
 disabled : Boolean
読み取り専用です。このコンポーネントが無効の場合はtrueが設定されます。
True if this component is disabled. Read-only.
Ext.Component
 hidden : Boolean
このコンポーネントが隠れている場合はtrueが設定されます。読み取り専用です。
True if this component is hidden. Read-only.
Ext.Component
 initialConfig : Object
このコンポーネントの初回に設定された指定。読み取り専用です。
This Component's initial configuration specification. Read-only.
Ext.Component
 items : MixedCollection
Ext.util.MixedCollectionとしてのコンテナのコンポーネントコレクション
The collection of components in this container as a
Ext.util.MixedCollection
Ext.Container
 rendered : Boolean
このコンポーネントがレンダリングされている場合はtrueが設定されます。読み取り専用です。
True if this component has been rendered. Read-only.
Ext.Component

メソッド

メソッド定義クラス

イベント

イベント定義クラス