<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='Ext-grid-GridPanel-method-constructor'><span id='Ext-grid-GridPanel'>/**
</span></span> * @class Ext.grid.GridPanel
 * @extends Ext.Panel
 * &lt;p&gt;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:&lt;/p&gt;
 * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
 * &lt;li&gt;&lt;b&gt;{@link Ext.data.Store Store}&lt;/b&gt; : The Model holding the data records (rows)
 * &lt;div class=&quot;sub-desc&quot;&gt;&lt;/div&gt;&lt;/li&gt;
 * &lt;li&gt;&lt;b&gt;{@link Ext.grid.ColumnModel Column model}&lt;/b&gt; : Column makeup
 * &lt;div class=&quot;sub-desc&quot;&gt;&lt;/div&gt;&lt;/li&gt;
 * &lt;li&gt;&lt;b&gt;{@link Ext.grid.GridView View}&lt;/b&gt; : Encapsulates the user interface
 * &lt;div class=&quot;sub-desc&quot;&gt;&lt;/div&gt;&lt;/li&gt;
 * &lt;li&gt;&lt;b&gt;{@link Ext.grid.AbstractSelectionModel selection model}&lt;/b&gt; : Selection behavior
 * &lt;div class=&quot;sub-desc&quot;&gt;&lt;/div&gt;&lt;/li&gt;
 * &lt;/ul&gt;&lt;/div&gt;
 * &lt;p&gt;Example usage:&lt;/p&gt;
 * &lt;pre&gt;&lt;code&gt;
var grid = new Ext.grid.GridPanel({
    {@link #store}: new {@link Ext.data.Store}({
        {@link Ext.data.Store#autoDestroy autoDestroy}: true,
        {@link Ext.data.Store#reader reader}: reader,
        {@link Ext.data.Store#data data}: xg.dummyData
    }),
    {@link #colModel}: new {@link Ext.grid.ColumnModel}({
        {@link Ext.grid.ColumnModel#defaults defaults}: {
            width: 120,
            sortable: true
        },
        {@link Ext.grid.ColumnModel#columns 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'
            }
        ]
    }),
    {@link #viewConfig}: {
        {@link Ext.grid.GridView#forceFit forceFit}: true,

//      Return CSS class to apply to rows depending upon data values
        {@link Ext.grid.GridView#getRowClass getRowClass}: function(record, index) {
            var c = record.{@link Ext.data.Record#get get}('change');
            if (c &lt; 0) {
                return 'price-fall';
            } else if (c &gt; 0) {
                return 'price-rise';
            }
        }
    },
    {@link #sm}: new Ext.grid.RowSelectionModel({singleSelect:true}),
    width: 600,
    height: 300,
    frame: true,
    title: 'Framed with Row Selection and Horizontal Scrolling',
    iconCls: 'icon-grid'
});
 * &lt;/code&gt;&lt;/pre&gt;
 * &lt;p&gt;&lt;b&gt;&lt;u&gt;Notes:&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;
 * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
 * &lt;li&gt;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.&lt;/li&gt;
 * &lt;li&gt;A grid &lt;b&gt;requires&lt;/b&gt; 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
 * &lt;tt&gt;{@link Ext.BoxComponent#height height}&lt;/tt&gt; and &lt;tt&gt;{@link Ext.BoxComponent#width width}&lt;/tt&gt;
 * configuration options or implicitly set by using the grid as a child item of a
 * {@link Ext.Container Container} which will have a {@link Ext.Container#layout layout manager}
 * provide the sizing of its child items (for example the Container of the Grid may specify
 * &lt;tt&gt;{@link Ext.Container#layout layout}:'fit'&lt;/tt&gt;).&lt;/li&gt;
 * &lt;li&gt;To access the data in a Grid, it is necessary to use the data model encapsulated
 * by the {@link #store Store}. See the {@link #cellclick} event for more details.&lt;/li&gt;
 * &lt;/ul&gt;&lt;/div&gt;
 * @constructor
 * @param {Object} config The config object
 * @xtype grid
 */
Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
<span id='Ext-grid-GridPanel-cfg-autoExpandColumn'>    /**
</span>     * @cfg {String} autoExpandColumn
     * &lt;p&gt;The &lt;tt&gt;{@link Ext.grid.Column#id id}&lt;/tt&gt; of a {@link Ext.grid.Column column} in
     * this grid that should expand to fill unused space. This value specified here can not
     * be &lt;tt&gt;0&lt;/tt&gt;.&lt;/p&gt;
     * &lt;br&gt;&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: If the Grid's {@link Ext.grid.GridView view} is configured with
     * &lt;tt&gt;{@link Ext.grid.GridView#forceFit forceFit}=true&lt;/tt&gt; the &lt;tt&gt;autoExpandColumn&lt;/tt&gt;
     * is ignored. See {@link Ext.grid.Column}.&lt;tt&gt;{@link Ext.grid.Column#width width}&lt;/tt&gt;
     * for additional details.&lt;/p&gt;
     * &lt;p&gt;See &lt;tt&gt;{@link #autoExpandMax}&lt;/tt&gt; and &lt;tt&gt;{@link #autoExpandMin}&lt;/tt&gt; also.&lt;/p&gt;
     */
    autoExpandColumn : false,
    
<span id='Ext-grid-GridPanel-cfg-autoExpandMax'>    /**
</span>     * @cfg {Number} autoExpandMax The maximum width the &lt;tt&gt;{@link #autoExpandColumn}&lt;/tt&gt;
     * can have (if enabled). Defaults to &lt;tt&gt;1000&lt;/tt&gt;.
     */
    autoExpandMax : 1000,
    
<span id='Ext-grid-GridPanel-cfg-autoExpandMin'>    /**
</span>     * @cfg {Number} autoExpandMin The minimum width the &lt;tt&gt;{@link #autoExpandColumn}&lt;/tt&gt;
     * can have (if enabled). Defaults to &lt;tt&gt;50&lt;/tt&gt;.
     */
    autoExpandMin : 50,
    
<span id='Ext-grid-GridPanel-cfg-columnLines'>    /**
</span>     * @cfg {Boolean} columnLines &lt;tt&gt;true&lt;/tt&gt; to add css for column separation lines.
     * Default is &lt;tt&gt;false&lt;/tt&gt;.
     */
    columnLines : false,
    
<span id='Ext-grid-GridPanel-cfg-cm'>    /**
</span>     * @cfg {Object} cm Shorthand for &lt;tt&gt;{@link #colModel}&lt;/tt&gt;.
     */
<span id='Ext-grid-GridPanel-cfg-colModel'>    /**
</span>     * @cfg {Object} colModel The {@link Ext.grid.ColumnModel} to use when rendering the grid (required).
     */
<span id='Ext-grid-GridPanel-cfg-columns'>    /**
</span>     * @cfg {Array} columns An array of {@link Ext.grid.Column columns} to auto create a
     * {@link Ext.grid.ColumnModel}.  The ColumnModel may be explicitly created via the
     * &lt;tt&gt;{@link #colModel}&lt;/tt&gt; configuration property.
     */
<span id='Ext-grid-GridPanel-cfg-ddGroup'>    /**
</span>     * @cfg {String} ddGroup The DD group this GridPanel belongs to. Defaults to &lt;tt&gt;'GridDD'&lt;/tt&gt; if not specified.
     */
<span id='Ext-grid-GridPanel-cfg-ddText'>    /**
</span>     * @cfg {String} ddText
     * Configures the text in the drag proxy.  Defaults to:
     * &lt;pre&gt;&lt;code&gt;
     * ddText : '{0} selected row{1}'
     * &lt;/code&gt;&lt;/pre&gt;
     * &lt;tt&gt;{0}&lt;/tt&gt; is replaced with the number of selected rows.
     */
    ddText : '{0} selected row{1}',

<span id='Ext-grid-GridPanel-cfg-dragCell'>    /**
</span>     * @cfg {Boolean} dragCell Defaults to &lt;code&gt;false&lt;/code&gt;. If using {@link #enableDragDrop} with a CellSelectionModel,
     * set this to true to have the {@link #getView view}'s {@link Ext.grid.GridView#dragZone dragZone}'s &lt;code&gt;getDragData&lt;/code&gt;
     * method reference the selected &lt;b&gt;cell&lt;/b&gt; using &lt;code&gt;[rowIndex, cellIndex]&lt;/code&gt;
     */

<span id='Ext-grid-GridPanel-cfg-deferRowRender'>    /**
</span>     * @cfg {Boolean} deferRowRender &lt;P&gt;Defaults to &lt;tt&gt;true&lt;/tt&gt; to enable deferred row rendering.&lt;/p&gt;
     * &lt;p&gt;This allows the GridPanel to be initially rendered empty, with the expensive update of the row
     * structure deferred so that layouts with GridPanels appear more quickly.&lt;/p&gt;
     */
    deferRowRender : true,
    
<span id='Ext-grid-GridPanel-cfg-disableSelection'>    /**
</span>     * @cfg {Boolean} disableSelection &lt;p&gt;&lt;tt&gt;true&lt;/tt&gt; to disable selections in the grid. Defaults to &lt;tt&gt;false&lt;/tt&gt;.&lt;/p&gt;
     * &lt;p&gt;Ignored if a {@link #selModel SelectionModel} is specified.&lt;/p&gt;
     */
<span id='Ext-grid-GridPanel-cfg-enableColumnResize'>    /**
</span>     * @cfg {Boolean} enableColumnResize &lt;tt&gt;false&lt;/tt&gt; to turn off column resizing for the whole grid. Defaults to &lt;tt&gt;true&lt;/tt&gt;.
     */
<span id='Ext-grid-GridPanel-cfg-enableColumnHide'>    /**
</span>     * @cfg {Boolean} enableColumnHide
     * Defaults to &lt;tt&gt;true&lt;/tt&gt; to enable {@link Ext.grid.Column#hidden hiding of columns}
     * with the {@link #enableHdMenu header menu}.
     */
    enableColumnHide : true,
    
<span id='Ext-grid-GridPanel-cfg-enableColumnMove'>    /**
</span>     * @cfg {Boolean} enableColumnMove Defaults to &lt;tt&gt;true&lt;/tt&gt; to enable drag and drop reorder of columns. &lt;tt&gt;false&lt;/tt&gt;
     * to turn off column reordering via drag drop.
     */
    enableColumnMove : true,
    
<span id='Ext-grid-GridPanel-cfg-enableDragDrop'>    /**
</span>     * @cfg {Boolean} enableDragDrop &lt;p&gt;Enables dragging of the selected rows of the GridPanel. Defaults to &lt;tt&gt;false&lt;/tt&gt;.&lt;/p&gt;
     * &lt;p&gt;Setting this to &lt;b&gt;&lt;tt&gt;true&lt;/tt&gt;&lt;/b&gt; causes this GridPanel's {@link #getView GridView} to
     * create an instance of {@link Ext.grid.GridDragZone}. &lt;b&gt;Note&lt;/b&gt;: this is available only &lt;b&gt;after&lt;/b&gt;
     * the Grid has been rendered as the GridView's &lt;tt&gt;{@link Ext.grid.GridView#dragZone dragZone}&lt;/tt&gt;
     * property.&lt;/p&gt;
     * &lt;p&gt;A cooperating {@link Ext.dd.DropZone DropZone} must be created who's implementations of
     * {@link Ext.dd.DropZone#onNodeEnter onNodeEnter}, {@link Ext.dd.DropZone#onNodeOver onNodeOver},
     * {@link Ext.dd.DropZone#onNodeOut onNodeOut} and {@link Ext.dd.DropZone#onNodeDrop onNodeDrop} are able
     * to process the {@link Ext.grid.GridDragZone#getDragData data} which is provided.&lt;/p&gt;
     */
    enableDragDrop : false,
    
<span id='Ext-grid-GridPanel-cfg-enableHdMenu'>    /**
</span>     * @cfg {Boolean} enableHdMenu Defaults to &lt;tt&gt;true&lt;/tt&gt; to enable the drop down button for menu in the headers.
     */
    enableHdMenu : true,
    
<span id='Ext-grid-GridPanel-cfg-hideHeaders'>    /**
</span>     * @cfg {Boolean} hideHeaders True to hide the grid's header. Defaults to &lt;code&gt;false&lt;/code&gt;.
     */
<span id='Ext-grid-GridPanel-cfg-loadMask'>    /**
</span>     * @cfg {Object} loadMask An {@link Ext.LoadMask} config or true to mask the grid while
     * loading. Defaults to &lt;code&gt;false&lt;/code&gt;.
     */
    loadMask : false,
    
<span id='Ext-grid-GridPanel-cfg-maxHeight'>    /**
</span>     * @cfg {Number} maxHeight Sets the maximum height of the grid - ignored if &lt;tt&gt;autoHeight&lt;/tt&gt; is not on.
     */
<span id='Ext-grid-GridPanel-cfg-minColumnWidth'>    /**
</span>     * @cfg {Number} minColumnWidth The minimum width a column can be resized to. Defaults to &lt;tt&gt;25&lt;/tt&gt;.
     */
    minColumnWidth : 25,
    
<span id='Ext-grid-GridPanel-cfg-sm'>    /**
</span>     * @cfg {Object} sm Shorthand for &lt;tt&gt;{@link #selModel}&lt;/tt&gt;.
     */
<span id='Ext-grid-GridPanel-cfg-selModel'>    /**
</span>     * @cfg {Object} selModel Any subclass of {@link Ext.grid.AbstractSelectionModel} that will provide
     * the selection model for the grid (defaults to {@link Ext.grid.RowSelectionModel} if not specified).
     */
<span id='Ext-grid-GridPanel-cfg-store'>    /**
</span>     * @cfg {Ext.data.Store} store The {@link Ext.data.Store} the grid should use as its data source (required).
     */
<span id='Ext-grid-GridPanel-cfg-stripeRows'>    /**
</span>     * @cfg {Boolean} stripeRows &lt;tt&gt;true&lt;/tt&gt; to stripe the rows. Default is &lt;tt&gt;false&lt;/tt&gt;.
     * &lt;p&gt;This causes the CSS class &lt;tt&gt;&lt;b&gt;x-grid3-row-alt&lt;/b&gt;&lt;/tt&gt; to be added to alternate rows of
     * the grid. A default CSS rule is provided which sets a background colour, but you can override this
     * with a rule which either overrides the &lt;b&gt;background-color&lt;/b&gt; style using the '!important'
     * modifier, or which uses a CSS selector of higher specificity.&lt;/p&gt;
     */
    stripeRows : false,
    
<span id='Ext-grid-GridPanel-cfg-trackMouseOver'>    /**
</span>     * @cfg {Boolean} trackMouseOver True to highlight rows when the mouse is over. Default is &lt;tt&gt;true&lt;/tt&gt;
     * for GridPanel, but &lt;tt&gt;false&lt;/tt&gt; for EditorGridPanel.
     */
    trackMouseOver : true,
    
<span id='Ext-grid-GridPanel-cfg-stateEvents'>    /**
</span>     * @cfg {Array} stateEvents
     * An array of events that, when fired, should trigger this component to save its state.
     * Defaults to:&lt;pre&gt;&lt;code&gt;
     * stateEvents: ['columnmove', 'columnresize', 'sortchange', 'groupchange']
     * &lt;/code&gt;&lt;/pre&gt;
     * &lt;p&gt;These can be any types of events supported by this component, including browser or
     * custom events (e.g., &lt;tt&gt;['click', 'customerchange']&lt;/tt&gt;).&lt;/p&gt;
     * &lt;p&gt;See {@link Ext.Component#stateful} for an explanation of saving and restoring
     * Component state.&lt;/p&gt;
     */
    stateEvents : ['columnmove', 'columnresize', 'sortchange', 'groupchange'],
    
<span id='Ext-grid-GridPanel-cfg-view'>    /**
</span>     * @cfg {Object} view The {@link Ext.grid.GridView} used by the grid. This can be set
     * before a call to {@link Ext.Component#render render()}.
     */
    view : null,

<span id='Ext-grid-GridPanel-cfg-bubbleEvents'>    /**
</span>     * @cfg {Array} bubbleEvents
     * &lt;p&gt;An array of events that, when fired, should be bubbled to any parent container.
     * See {@link Ext.util.Observable#enableBubble}.
     * Defaults to &lt;tt&gt;[]&lt;/tt&gt;.
     */
    bubbleEvents: [],

<span id='Ext-grid-GridPanel-cfg-viewConfig'>    /**
</span>     * @cfg {Object} viewConfig A config object that will be applied to the grid's UI view.  Any of
     * the config options available for {@link Ext.grid.GridView} can be specified here. This option
     * is ignored if &lt;tt&gt;{@link #view}&lt;/tt&gt; is specified.
     */

<span id='Ext-grid-GridPanel-property-rendered'>    // private
</span>    rendered : false,
    
<span id='Ext-grid-GridPanel-property-viewReady'>    // private
</span>    viewReady : false,

<span id='Ext-grid-GridPanel-method-initComponent'>    // private
</span>    initComponent : function() {
        Ext.grid.GridPanel.superclass.initComponent.call(this);

        if (this.columnLines) {
            this.cls = (this.cls || '') + ' x-grid-with-col-lines';
        }
        // override any provided value since it isn't valid
        // and is causing too many bug reports ;)
        this.autoScroll = false;
        this.autoWidth = false;

        if(Ext.isArray(this.columns)){
            this.colModel = new Ext.grid.ColumnModel(this.columns);
            delete this.columns;
        }

        // check and correct shorthanded configs
        if(this.ds){
            this.store = this.ds;
            delete this.ds;
        }
        if(this.cm){
            this.colModel = this.cm;
            delete this.cm;
        }
        if(this.sm){
            this.selModel = this.sm;
            delete this.sm;
        }
        this.store = Ext.StoreMgr.lookup(this.store);

        this.addEvents(
            // raw events
<span id='Ext-grid-GridPanel-event-click'>            /**
</span>             * @event click
             * The raw click event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'click',
<span id='Ext-grid-GridPanel-event-dblclick'>            /**
</span>             * @event dblclick
             * The raw dblclick event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'dblclick',
<span id='Ext-grid-GridPanel-event-contextmenu'>            /**
</span>             * @event contextmenu
             * The raw contextmenu event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'contextmenu',
<span id='Ext-grid-GridPanel-event-mousedown'>            /**
</span>             * @event mousedown
             * The raw mousedown event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'mousedown',
<span id='Ext-grid-GridPanel-event-mouseup'>            /**
</span>             * @event mouseup
             * The raw mouseup event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'mouseup',
<span id='Ext-grid-GridPanel-event-mouseover'>            /**
</span>             * @event mouseover
             * The raw mouseover event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'mouseover',
<span id='Ext-grid-GridPanel-event-mouseout'>            /**
</span>             * @event mouseout
             * The raw mouseout event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'mouseout',
<span id='Ext-grid-GridPanel-event-keypress'>            /**
</span>             * @event keypress
             * The raw keypress event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'keypress',
<span id='Ext-grid-GridPanel-event-keydown'>            /**
</span>             * @event keydown
             * The raw keydown event for the entire grid.
             * @param {Ext.EventObject} e
             */
            'keydown',

            // custom events
<span id='Ext-grid-GridPanel-event-cellmousedown'>            /**
</span>             * @event cellmousedown
             * Fires before a cell is clicked
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Number} columnIndex
             * @param {Ext.EventObject} e
             */
            'cellmousedown',
<span id='Ext-grid-GridPanel-event-rowmousedown'>            /**
</span>             * @event rowmousedown
             * Fires before a row is clicked
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowmousedown',
<span id='Ext-grid-GridPanel-event-headermousedown'>            /**
</span>             * @event headermousedown
             * Fires before a header is clicked
             * @param {Grid} this
             * @param {Number} columnIndex
             * @param {Ext.EventObject} e
             */
            'headermousedown',

<span id='Ext-grid-GridPanel-event-groupmousedown'>            /**
</span>             * @event groupmousedown
             * Fires before a group header is clicked. &lt;b&gt;Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}&lt;/b&gt;.
             * @param {Grid} this
             * @param {String} groupField
             * @param {String} groupValue
             * @param {Ext.EventObject} e
             */
            'groupmousedown',

<span id='Ext-grid-GridPanel-event-rowbodymousedown'>            /**
</span>             * @event rowbodymousedown
             * Fires before the row body is clicked. &lt;b&gt;Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.&lt;/b&gt;
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowbodymousedown',

<span id='Ext-grid-GridPanel-event-containermousedown'>            /**
</span>             * @event containermousedown
             * Fires before the container is clicked. The container consists of any part of the grid body that is not covered by a row.
             * @param {Grid} this
             * @param {Ext.EventObject} e
             */
            'containermousedown',

<span id='Ext-grid-GridPanel-event-cellclick'>            /**
</span>             * @event cellclick
             * Fires when a cell is clicked.
             * The data for the cell is drawn from the {@link Ext.data.Record Record}
             * for this row. To access the data in the listener function use the
             * following technique:
             * &lt;pre&gt;&lt;code&gt;
function(grid, rowIndex, columnIndex, e) {
    var record = grid.getStore().getAt(rowIndex);  // Get the Record
    var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name
    var data = record.get(fieldName);
}
&lt;/code&gt;&lt;/pre&gt;
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Number} columnIndex
             * @param {Ext.EventObject} e
             */
            'cellclick',
<span id='Ext-grid-GridPanel-event-celldblclick'>            /**
</span>             * @event celldblclick
             * Fires when a cell is double clicked
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Number} columnIndex
             * @param {Ext.EventObject} e
             */
            'celldblclick',
<span id='Ext-grid-GridPanel-event-rowclick'>            /**
</span>             * @event rowclick
             * Fires when a row is clicked
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowclick',
<span id='Ext-grid-GridPanel-event-rowdblclick'>            /**
</span>             * @event rowdblclick
             * Fires when a row is double clicked
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowdblclick',
<span id='Ext-grid-GridPanel-event-headerclick'>            /**
</span>             * @event headerclick
             * Fires when a header is clicked
             * @param {Grid} this
             * @param {Number} columnIndex
             * @param {Ext.EventObject} e
             */
            'headerclick',
<span id='Ext-grid-GridPanel-event-headerdblclick'>            /**
</span>             * @event headerdblclick
             * Fires when a header cell is double clicked
             * @param {Grid} this
             * @param {Number} columnIndex
             * @param {Ext.EventObject} e
             */
            'headerdblclick',
<span id='Ext-grid-GridPanel-event-groupclick'>            /**
</span>             * @event groupclick
             * Fires when group header is clicked. &lt;b&gt;Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}&lt;/b&gt;.
             * @param {Grid} this
             * @param {String} groupField
             * @param {String} groupValue
             * @param {Ext.EventObject} e
             */
            'groupclick',
<span id='Ext-grid-GridPanel-event-groupdblclick'>            /**
</span>             * @event groupdblclick
             * Fires when group header is double clicked. &lt;b&gt;Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}&lt;/b&gt;.
             * @param {Grid} this
             * @param {String} groupField
             * @param {String} groupValue
             * @param {Ext.EventObject} e
             */
            'groupdblclick',
<span id='Ext-grid-GridPanel-event-containerclick'>            /**
</span>             * @event containerclick
             * Fires when the container is clicked. The container consists of any part of the grid body that is not covered by a row.
             * @param {Grid} this
             * @param {Ext.EventObject} e
             */
            'containerclick',
<span id='Ext-grid-GridPanel-event-containerdblclick'>            /**
</span>             * @event containerdblclick
             * Fires when the container is double clicked. The container consists of any part of the grid body that is not covered by a row.
             * @param {Grid} this
             * @param {Ext.EventObject} e
             */
            'containerdblclick',

<span id='Ext-grid-GridPanel-event-rowbodyclick'>            /**
</span>             * @event rowbodyclick
             * Fires when the row body is clicked. &lt;b&gt;Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.&lt;/b&gt;
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowbodyclick',
<span id='Ext-grid-GridPanel-event-rowbodydblclick'>            /**
</span>             * @event rowbodydblclick
             * Fires when the row body is double clicked. &lt;b&gt;Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.&lt;/b&gt;
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowbodydblclick',

<span id='Ext-grid-GridPanel-event-rowcontextmenu'>            /**
</span>             * @event rowcontextmenu
             * Fires when a row is right clicked
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowcontextmenu',
<span id='Ext-grid-GridPanel-event-cellcontextmenu'>            /**
</span>             * @event cellcontextmenu
             * Fires when a cell is right clicked
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Number} cellIndex
             * @param {Ext.EventObject} e
             */
            'cellcontextmenu',
<span id='Ext-grid-GridPanel-event-headercontextmenu'>            /**
</span>             * @event headercontextmenu
             * Fires when a header is right clicked
             * @param {Grid} this
             * @param {Number} columnIndex
             * @param {Ext.EventObject} e
             */
            'headercontextmenu',
<span id='Ext-grid-GridPanel-event-groupcontextmenu'>            /**
</span>             * @event groupcontextmenu
             * Fires when group header is right clicked. &lt;b&gt;Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}&lt;/b&gt;.
             * @param {Grid} this
             * @param {String} groupField
             * @param {String} groupValue
             * @param {Ext.EventObject} e
             */
            'groupcontextmenu',
<span id='Ext-grid-GridPanel-event-containercontextmenu'>            /**
</span>             * @event containercontextmenu
             * Fires when the container is right clicked. The container consists of any part of the grid body that is not covered by a row.
             * @param {Grid} this
             * @param {Ext.EventObject} e
             */
            'containercontextmenu',
<span id='Ext-grid-GridPanel-event-rowbodycontextmenu'>            /**
</span>             * @event rowbodycontextmenu
             * Fires when the row body is right clicked. &lt;b&gt;Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.&lt;/b&gt;
             * @param {Grid} this
             * @param {Number} rowIndex
             * @param {Ext.EventObject} e
             */
            'rowbodycontextmenu',
<span id='Ext-grid-GridPanel-event-bodyscroll'>            /**
</span>             * @event bodyscroll
             * Fires when the body element is scrolled
             * @param {Number} scrollLeft
             * @param {Number} scrollTop
             */
            'bodyscroll',
<span id='Ext-grid-GridPanel-event-columnresize'>            /**
</span>             * @event columnresize
             * Fires when the user resizes a column
             * @param {Number} columnIndex
             * @param {Number} newSize
             */
            'columnresize',
<span id='Ext-grid-GridPanel-event-columnmove'>            /**
</span>             * @event columnmove
             * Fires when the user moves a column
             * @param {Number} oldIndex
             * @param {Number} newIndex
             */
            'columnmove',
<span id='Ext-grid-GridPanel-event-sortchange'>            /**
</span>             * @event sortchange
             * Fires when the grid's store sort changes
             * @param {Grid} this
             * @param {Object} sortInfo An object with the keys field and direction
             */
            'sortchange',
<span id='Ext-grid-GridPanel-event-groupchange'>            /**
</span>             * @event groupchange
             * Fires when the grid's grouping changes (only applies for grids with a {@link Ext.grid.GroupingView GroupingView})
             * @param {Grid} this
             * @param {String} groupField A string with the grouping field, null if the store is not grouped.
             */
            'groupchange',
<span id='Ext-grid-GridPanel-event-reconfigure'>            /**
</span>             * @event reconfigure
             * Fires when the grid is reconfigured with a new store and/or column model.
             * @param {Grid} this
             * @param {Ext.data.Store} store The new store
             * @param {Ext.grid.ColumnModel} colModel The new column model
             */
            'reconfigure',
<span id='Ext-grid-GridPanel-event-viewready'>            /**
</span>             * @event viewready
             * Fires when the grid view is available (use this for selecting a default row).
             * @param {Grid} this
             */
            'viewready'
        );
    },

<span id='Ext-grid-GridPanel-method-onRender'>    // private
</span>    onRender : function(ct, position){
        Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);

        var c = this.getGridEl();

        this.el.addClass('x-grid-panel');

        this.mon(c, {
            scope: this,
            mousedown: this.onMouseDown,
            click: this.onClick,
            dblclick: this.onDblClick,
            contextmenu: this.onContextMenu
        });

        this.relayEvents(c, ['mousedown','mouseup','mouseover','mouseout','keypress', 'keydown']);

        var view = this.getView();
        view.init(this);
        view.render();
        this.getSelectionModel().init(this);
    },

<span id='Ext-grid-GridPanel-method-initEvents'>    // private
</span>    initEvents : function(){
        Ext.grid.GridPanel.superclass.initEvents.call(this);

        if(this.loadMask){
            this.loadMask = new Ext.LoadMask(this.bwrap,
                    Ext.apply({store:this.store}, this.loadMask));
        }
    },

<span id='Ext-grid-GridPanel-method-initStateEvents'>    initStateEvents : function(){
</span>        Ext.grid.GridPanel.superclass.initStateEvents.call(this);
        this.mon(this.colModel, 'hiddenchange', this.saveState, this, {delay: 100});
    },

<span id='Ext-grid-GridPanel-method-applyState'>    applyState : function(state){
</span>        var cm = this.colModel,
            cs = state.columns,
            store = this.store,
            s,
            c,
            colIndex;

        if(cs){
            for(var i = 0, len = cs.length; i &lt; len; i++){
                s = cs[i];
                c = cm.getColumnById(s.id);
                if(c){
                    colIndex = cm.getIndexById(s.id);
                    cm.setState(colIndex, {
                        hidden: s.hidden,
                        width: s.width,
                        sortable: c.sortable,
                        editable: c.editable
                    });
                    if(colIndex != i){
                        cm.moveColumn(colIndex, i);
                    }
                }
            }
        }
        if(store){
            s = state.sort;
            if(s){
                store[store.remoteSort ? 'setDefaultSort' : 'sort'](s.field, s.direction);
            }
            s = state.group;
            if(store.groupBy){
                if(s){
                    store.groupBy(s);
                }else{
                    store.clearGrouping();
                }
            }

        }
        var o = Ext.apply({}, state);
        delete o.columns;
        delete o.sort;
        Ext.grid.GridPanel.superclass.applyState.call(this, o);
    },

<span id='Ext-grid-GridPanel-method-getState'>    getState : function(){
</span>        var o = {columns: []},
            store = this.store,
            ss,
            gs;

        for(var i = 0, c; (c = this.colModel.config[i]); i++){
            o.columns[i] = {
                id: c.id,
                width: c.width
            };
            if(c.hidden){
                o.columns[i].hidden = true;
            }
        }
        if(store){
            ss = store.getSortState();
            if(ss){
                o.sort = ss;
            }
            if(store.getGroupState){
                gs = store.getGroupState();
                if(gs){
                    o.group = gs;
                }
            }
        }
        return o;
    },

<span id='Ext-grid-GridPanel-method-afterRender'>    // private
</span>    afterRender : function(){
        Ext.grid.GridPanel.superclass.afterRender.call(this);
        var v = this.view;
        this.on('bodyresize', v.layout, v);
        v.layout(true);
        if(this.deferRowRender){
            if (!this.deferRowRenderTask){
                this.deferRowRenderTask = new Ext.util.DelayedTask(v.afterRender, this.view);
            }
            this.deferRowRenderTask.delay(10);
        }else{
            v.afterRender();
        }
        this.viewReady = true;
    },

<span id='Ext-grid-GridPanel-method-reconfigure'>    /**
</span>     * &lt;p&gt;Reconfigures the grid to use a different Store and Column Model
     * and fires the 'reconfigure' event. The View will be bound to the new
     * objects and refreshed.&lt;/p&gt;
     * &lt;p&gt;Be aware that upon reconfiguring a GridPanel, certain existing settings &lt;i&gt;may&lt;/i&gt; become
     * invalidated. For example the configured {@link #autoExpandColumn} may no longer exist in the
     * new ColumnModel. Also, an existing {@link Ext.PagingToolbar PagingToolbar} will still be bound
     * to the old Store, and will need rebinding. Any {@link #plugins} might also need reconfiguring
     * with the new data.&lt;/p&gt;
     * @param {Ext.data.Store} store The new {@link Ext.data.Store} object
     * @param {Ext.grid.ColumnModel} colModel The new {@link Ext.grid.ColumnModel} object
     */
    reconfigure : function(store, colModel){
        var rendered = this.rendered;
        if(rendered){
            if(this.loadMask){
                this.loadMask.destroy();
                this.loadMask = new Ext.LoadMask(this.bwrap,
                        Ext.apply({}, {store:store}, this.initialConfig.loadMask));
            }
        }
        if(this.view){
            this.view.initData(store, colModel);
        }
        this.store = store;
        this.colModel = colModel;
        if(rendered){
            this.view.refresh(true);
        }
        this.fireEvent('reconfigure', this, store, colModel);
    },

<span id='Ext-grid-GridPanel-method-onDestroy'>    // private
</span>    onDestroy : function(){
        if (this.deferRowRenderTask &amp;&amp; this.deferRowRenderTask.cancel){
            this.deferRowRenderTask.cancel();
        }
        if(this.rendered){
            Ext.destroy(this.view, this.loadMask);
        }else if(this.store &amp;&amp; this.store.autoDestroy){
            this.store.destroy();
        }
        Ext.destroy(this.colModel, this.selModel);
        this.store = this.selModel = this.colModel = this.view = this.loadMask = null;
        Ext.grid.GridPanel.superclass.onDestroy.call(this);
    },

<span id='Ext-grid-GridPanel-method-processEvent'>    // private
</span>    processEvent : function(name, e){
        this.view.processEvent(name, e);
    },

<span id='Ext-grid-GridPanel-method-onClick'>    // private
</span>    onClick : function(e){
        this.processEvent('click', e);
    },

<span id='Ext-grid-GridPanel-method-onMouseDown'>    // private
</span>    onMouseDown : function(e){
        this.processEvent('mousedown', e);
    },

<span id='Ext-grid-GridPanel-method-onContextMenu'>    // private
</span>    onContextMenu : function(e, t){
        this.processEvent('contextmenu', e);
    },

<span id='Ext-grid-GridPanel-method-onDblClick'>    // private
</span>    onDblClick : function(e){
        this.processEvent('dblclick', e);
    },

<span id='Ext-grid-GridPanel-method-walkCells'>    // private
</span>    walkCells : function(row, col, step, fn, scope){
        var cm    = this.colModel,
            clen  = cm.getColumnCount(),
            ds    = this.store,
            rlen  = ds.getCount(),
            first = true;

        if(step &lt; 0){
            if(col &lt; 0){
                row--;
                first = false;
            }
            while(row &gt;= 0){
                if(!first){
                    col = clen-1;
                }
                first = false;
                while(col &gt;= 0){
                    if(fn.call(scope || this, row, col, cm) === true){
                        return [row, col];
                    }
                    col--;
                }
                row--;
            }
        } else {
            if(col &gt;= clen){
                row++;
                first = false;
            }
            while(row &lt; rlen){
                if(!first){
                    col = 0;
                }
                first = false;
                while(col &lt; clen){
                    if(fn.call(scope || this, row, col, cm) === true){
                        return [row, col];
                    }
                    col++;
                }
                row++;
            }
        }
        return null;
    },

<span id='Ext-grid-GridPanel-method-getGridEl'>    /**
</span>     * Returns the grid's underlying element.
     * @return {Element} The element
     */
    getGridEl : function(){
        return this.body;
    },

<span id='Ext-grid-GridPanel-method-stopEditing'>    // private for compatibility, overridden by editor grid
</span>    stopEditing : Ext.emptyFn,

<span id='Ext-grid-GridPanel-method-getSelectionModel'>    /**
</span>     * Returns the grid's selection model configured by the &lt;code&gt;{@link #selModel}&lt;/code&gt;
     * configuration option. If no selection model was configured, this will create
     * and return a {@link Ext.grid.RowSelectionModel RowSelectionModel}.
     * @return {SelectionModel}
     */
    getSelectionModel : function(){
        if(!this.selModel){
            this.selModel = new Ext.grid.RowSelectionModel(
                    this.disableSelection ? {selectRow: Ext.emptyFn} : null);
        }
        return this.selModel;
    },

<span id='Ext-grid-GridPanel-method-getStore'>    /**
</span>     * Returns the grid's data store.
     * @return {Ext.data.Store} The store
     */
    getStore : function(){
        return this.store;
    },

<span id='Ext-grid-GridPanel-method-getColumnModel'>    /**
</span>     * Returns the grid's ColumnModel.
     * @return {Ext.grid.ColumnModel} The column model
     */
    getColumnModel : function(){
        return this.colModel;
    },

<span id='Ext-grid-GridPanel-method-getView'>    /**
</span>     * Returns the grid's GridView object.
     * @return {Ext.grid.GridView} The grid view
     */
    getView : function() {
        if (!this.view) {
            this.view = new Ext.grid.GridView(this.viewConfig);
        }
        
        return this.view;
    },
<span id='Ext-grid-GridPanel-method-getDragDropText'>    /**
</span>     * Called to get grid's drag proxy text, by default returns this.ddText.
     * @return {String} The text
     */
    getDragDropText : function(){
        var count = this.selModel.getCount ? this.selModel.getCount() : 1;
        return String.format(this.ddText, count, count == 1 ? '' : 's');
    }

<span id='Ext-grid-GridPanel-cfg-activeItem'>    /**
</span>     * @cfg {String/Number} activeItem
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-autoDestroy'>    /**
</span>     * @cfg {Boolean} autoDestroy
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-autoLoad'>    /**
</span>     * @cfg {Object/String/Function} autoLoad
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-autoWidth'>    /**
</span>     * @cfg {Boolean} autoWidth
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-bufferResize'>    /**
</span>     * @cfg {Boolean/Number} bufferResize
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-defaultType'>    /**
</span>     * @cfg {String} defaultType
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-defaults'>    /**
</span>     * @cfg {Object} defaults
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-hideBorders'>    /**
</span>     * @cfg {Boolean} hideBorders
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-items'>    /**
</span>     * @cfg {Mixed} items
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-layout'>    /**
</span>     * @cfg {String} layout
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-layoutConfig'>    /**
</span>     * @cfg {Object} layoutConfig
     * @hide
     */
<span id='Ext-grid-GridPanel-cfg-monitorResize'>    /**
</span>     * @cfg {Boolean} monitorResize
     * @hide
     */
<span id='Ext-grid-GridPanel-property-items'>    /**
</span>     * @property items
     * @hide
     */
<span id='Ext-grid-GridPanel-method-add'>    /**
</span>     * @method add
     * @hide
     */
<span id='Ext-grid-GridPanel-method-cascade'>    /**
</span>     * @method cascade
     * @hide
     */
<span id='Ext-grid-GridPanel-method-doLayout'>    /**
</span>     * @method doLayout
     * @hide
     */
<span id='Ext-grid-GridPanel-method-find'>    /**
</span>     * @method find
     * @hide
     */
<span id='Ext-grid-GridPanel-method-findBy'>    /**
</span>     * @method findBy
     * @hide
     */
<span id='Ext-grid-GridPanel-method-findById'>    /**
</span>     * @method findById
     * @hide
     */
<span id='Ext-grid-GridPanel-method-findByType'>    /**
</span>     * @method findByType
     * @hide
     */
<span id='Ext-grid-GridPanel-method-getComponent'>    /**
</span>     * @method getComponent
     * @hide
     */
<span id='Ext-grid-GridPanel-method-getLayout'>    /**
</span>     * @method getLayout
     * @hide
     */
<span id='Ext-grid-GridPanel-method-getUpdater'>    /**
</span>     * @method getUpdater
     * @hide
     */
<span id='Ext-grid-GridPanel-method-insert'>    /**
</span>     * @method insert
     * @hide
     */
<span id='Ext-grid-GridPanel-method-load'>    /**
</span>     * @method load
     * @hide
     */
<span id='Ext-grid-GridPanel-method-remove'>    /**
</span>     * @method remove
     * @hide
     */
<span id='Ext-grid-GridPanel-event-add'>    /**
</span>     * @event add
     * @hide
     */
<span id='Ext-grid-GridPanel-event-afterlayout'>    /**
</span>     * @event afterlayout
     * @hide
     */
<span id='Ext-grid-GridPanel-event-beforeadd'>    /**
</span>     * @event beforeadd
     * @hide
     */
<span id='Ext-grid-GridPanel-event-beforeremove'>    /**
</span>     * @event beforeremove
     * @hide
     */
<span id='Ext-grid-GridPanel-event-remove'>    /**
</span>     * @event remove
     * @hide
     */



<span id='Ext-grid-GridPanel-cfg-allowDomMove'>    /**
</span>     * @cfg {String} allowDomMove  @hide
     */
<span id='Ext-grid-GridPanel-cfg-autoEl'>    /**
</span>     * @cfg {String} autoEl @hide
     */
<span id='Ext-grid-GridPanel-cfg-applyTo'>    /**
</span>     * @cfg {String} applyTo  @hide
     */
<span id='Ext-grid-GridPanel-cfg-autoScroll'>    /**
</span>     * @cfg {String} autoScroll  @hide
     */
<span id='Ext-grid-GridPanel-cfg-bodyBorder'>    /**
</span>     * @cfg {String} bodyBorder  @hide
     */
<span id='Ext-grid-GridPanel-cfg-bodyStyle'>    /**
</span>     * @cfg {String} bodyStyle  @hide
     */
<span id='Ext-grid-GridPanel-cfg-contentEl'>    /**
</span>     * @cfg {String} contentEl  @hide
     */
<span id='Ext-grid-GridPanel-cfg-disabledClass'>    /**
</span>     * @cfg {String} disabledClass  @hide
     */
<span id='Ext-grid-GridPanel-cfg-elements'>    /**
</span>     * @cfg {String} elements  @hide
     */
<span id='Ext-grid-GridPanel-cfg-html'>    /**
</span>     * @cfg {String} html  @hide
     */
<span id='Ext-grid-GridPanel-cfg-preventBodyReset'>    /**
</span>     * @cfg {Boolean} preventBodyReset
     * @hide
     */
<span id='Ext-grid-GridPanel-property-disabled'>    /**
</span>     * @property disabled
     * @hide
     */
<span id='Ext-grid-GridPanel-method-applyToMarkup'>    /**
</span>     * @method applyToMarkup
     * @hide
     */
<span id='Ext-grid-GridPanel-method-enable'>    /**
</span>     * @method enable
     * @hide
     */
<span id='Ext-grid-GridPanel-method-disable'>    /**
</span>     * @method disable
     * @hide
     */
<span id='Ext-grid-GridPanel-method-setDisabled'>    /**
</span>     * @method setDisabled
     * @hide
     */
});
Ext.reg('grid', Ext.grid.GridPanel);</pre>
</body>
</html>