X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/src/widgets/grid/Column.js diff --git a/src/widgets/grid/Column.js b/src/widgets/grid/Column.js index 5c2d4571..d879792c 100644 --- a/src/widgets/grid/Column.js +++ b/src/widgets/grid/Column.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.0.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -11,28 +11,7 @@ *

While subclasses are provided to render data in different ways, this class renders a passed * data field unchanged and is usually used for textual columns.

*/ -Ext.grid.Column = function(config){ - Ext.apply(this, config); - - if(typeof this.renderer == 'string'){ - this.renderer = Ext.util.Format[this.renderer]; - } else if(Ext.isObject(this.renderer)){ - this.scope = this.renderer.scope; - this.renderer = this.renderer.fn; - } - this.renderer = this.renderer.createDelegate(this.scope || config); - - if(this.id === undefined){ - this.id = ++Ext.grid.Column.AUTO_ID; - } - if(this.editor){ - this.editor = Ext.create(this.editor, 'textfield'); - } -}; - -Ext.grid.Column.AUTO_ID = 0; - -Ext.grid.Column.prototype = { +Ext.grid.Column = Ext.extend(Object, { /** * @cfg {Boolean} editable Optional. Defaults to true, enabling the configured * {@link #editor}. Set to false to initially disable editing on this column. @@ -116,8 +95,8 @@ Ext.grid.Column.prototype = { */ /** * @cfg {Boolean} sortable Optional. true if sorting is to be allowed on this column. - * Defaults to the value of the {@link #defaultSortable} property. - * Whether local/remote sorting is used is specified in {@link Ext.data.Store#remoteSort}. + * Defaults to the value of the {@link Ext.grid.ColumnModel#defaultSortable} property. + * Whether local/remote sorting is used is specified in {@link Ext.data.Store#remoteSort}. */ /** * @cfg {Boolean} fixed Optional. true if the column width cannot be changed. Defaults to false. @@ -129,7 +108,10 @@ Ext.grid.Column.prototype = { * @cfg {Boolean} menuDisabled Optional. true to disable the column menu. Defaults to false. */ /** - * @cfg {Boolean} hidden Optional. true to hide the column. Defaults to false. + * @cfg {Boolean} hidden + * Optional. true to initially hide this column. Defaults to false. + * A hidden column {@link Ext.grid.GridPanel#enableColumnHide may be shown via the header row menu}. + * If a column is never to be shown, simply do not include this column in the Column Model at all. */ /** * @cfg {String} tooltip Optional. A text string to use as the column header's tooltip. If Quicktips @@ -226,8 +208,33 @@ var grid = new Ext.grid.GridPanel({ * if editing is supported by the grid. See {@link #editable} also. */ - // private. Used by ColumnModel to avoid reprocessing + /** + * @private + * @cfg {Boolean} isColumn + * Used by ColumnModel setConfig method to avoid reprocessing a Column + * if isColumn is not set ColumnModel will recreate a new Ext.grid.Column + * Defaults to true. + */ isColumn : true, + + constructor : function(config){ + Ext.apply(this, config); + + if(Ext.isString(this.renderer)){ + this.renderer = Ext.util.Format[this.renderer]; + }else if(Ext.isObject(this.renderer)){ + this.scope = this.renderer.scope; + this.renderer = this.renderer.fn; + } + if(!this.scope){ + this.scope = this; + } + + var ed = this.editor; + delete this.editor; + this.setEditor(ed); + }, + /** * Optional. A function which returns displayable data when passed the following parameters: *