X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/src/widgets/grid/ColumnModel.js diff --git a/src/widgets/grid/ColumnModel.js b/src/widgets/grid/ColumnModel.js index 09126668..3ab54c59 100644 --- a/src/widgets/grid/ColumnModel.js +++ b/src/widgets/grid/ColumnModel.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.0.3 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -35,7 +35,7 @@ * {@link Ext.grid.Column} column configuration object within the specified Array defines the initial * order of the column display. A Column's display may be initially hidden using the * {@link Ext.grid.Column#hidden hidden} config property (and then shown using the column - * header menu). Field's that are not included in the ColumnModel will not be displayable at all.

+ * header menu). Fields that are not included in the ColumnModel will not be displayable at all.

*

How each column in the grid correlates (maps) to the {@link Ext.data.Record} field in the * {@link Ext.data.Store Store} the column draws its data from is configured through the * {@link Ext.grid.Column#dataIndex dataIndex}. If the @@ -214,12 +214,16 @@ Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, { this.config = config; this.lookup = {}; - // if no id, create one + for(i = 0, len = config.length; i < len; i++){ c = Ext.applyIf(config[i], this.defaults); + // if no id, create one using column's ordinal position + if(typeof c.id == 'undefined'){ + c.id = i; + } if(!c.isColumn){ - var cls = Ext.grid.Column.types[c.xtype || 'gridcolumn']; - c = new cls(c); + var Cls = Ext.grid.Column.types[c.xtype || 'gridcolumn']; + c = new Cls(c); config[i] = c; } this.lookup[c.id] = c; @@ -313,7 +317,7 @@ var columns = grid.getColumnModel().getColumnsBy(function(c){ * @return {Boolean} */ isSortable : function(col){ - return this.config[col].sortable; + return !!this.config[col].sortable; }, /** @@ -520,22 +524,24 @@ var grid = new Ext.grid.GridPanel({ this.config[col].editable = editable; }, - /** - * Returns true if the column is hidden. + * Returns true if the column is {@link Ext.grid.Column#hidden hidden}, + * false otherwise. * @param {Number} colIndex The column index * @return {Boolean} */ isHidden : function(colIndex){ - return this.config[colIndex].hidden; + return !!this.config[colIndex].hidden; // ensure returns boolean }, - /** - * Returns true if the column width cannot be changed + * Returns true if the column is {@link Ext.grid.Column#fixed fixed}, + * false otherwise. + * @param {Number} colIndex The column index + * @return {Boolean} */ isFixed : function(colIndex){ - return this.config[colIndex].fixed; + return !!this.config[colIndex].fixed; }, /**