Properties Methods Events Config Options Direct Link
Observable
  ColumnModel

Class Ext.grid.ColumnModel

Package:Ext.grid
Defined In:ColumnModel.js
Class:ColumnModel
Subclasses:PropertyColumnModel
Extends:Observable
* This is the default implementation of a ColumnModel used by the Grid. This class is initialized with an Array of column config objects.

An individual column's config object defines the header string, the Ext.data.Record field the column draws its data from, an optional rendering function to provide customized data formatting, and the ability to apply a CSS class to all cells in a column through its id config option.

Usage:
var colModel = new Ext.grid.ColumnModel([
    { header: "Ticker", width: 60, sortable: true},
    { header: "Company Name", width: 150, sortable: true},
    { header: "Market Cap.", width: 100, sortable: true},
    { header: "$ Sales", width: 100, sortable: true, renderer: money},
    { header: "Employees", width: 100, sortable: true, resizable: false}
 ]);

The config options defined by this class are options which may appear in each individual column definition. In order to use configuration options from the superclass, specify the column configuration Array in the columns config property. eg:

var colModel = new Ext.grid.ColumnModel({
    listeners: {
        widthchange: function(cm, colIndex, width) {
            saveConfig(colIndex, width);
        }
    },
    columns: [
        { header: "Ticker", width: 60, sortable: true},
        { header: "Company Name", width: 150, sortable: true},
        { header: "Market Cap.", width: 100, sortable: true},
        { header: "$ Sales", width: 100, sortable: true, renderer: money},
        { header: "Employees", width: 100, sortable: true, resizable: false}
     ]
});

Config Options

Config Options Defined By
  align : String
(optional) Set the CSS text-align property of the column. Defaults to undefined.
ColumnModel
  css : String
(optional) Set custom CSS for all table cells in the column (excluding headers). Defaults to undefined.
ColumnModel
  editor : Ext.form.Field
(optional) The Ext.form.Field to use when editing values in this column if editing is supported by the grid.
ColumnModel
  fixed : Boolean
(optional) True if the column width cannot be changed. Defaults to false.
ColumnModel
  header : String
The header text to display in the Grid view.
ColumnModel
  hidden : Boolean
(optional) True to hide the column. Defaults to false.
ColumnModel
  menuDisabled : Boolean
(optional) True to disable the column menu. Defaults to false.
ColumnModel
  resizable : Boolean
(optional) False to disable column resizing. Defaults to true.
ColumnModel

Public Properties

Property Defined By
  defaultSortable : Boolean
Default sortable of columns which have no sortable specified (defaults to false)
ColumnModel
  defaultWidth : Number
The width of columns which have no width specified (defaults to 100)
ColumnModel

Public Methods

Method Defined By

Public Events

Event Defined By