\r
constructor : function(config){\r
Ext.apply(this, config);\r
-\r
+ \r
if(Ext.isString(this.renderer)){\r
this.renderer = Ext.util.Format[this.renderer];\r
}else if(Ext.isObject(this.renderer)){\r
if(!this.scope){\r
this.scope = this;\r
}\r
-\r
- if(this.editor){\r
- this.editor = Ext.create(this.editor, 'textfield');\r
- }\r
+ \r
+ var ed = this.editor;\r
+ delete this.editor;\r
+ this.setEditor(ed);\r
},\r
\r
<div id="prop-Ext.grid.Column-renderer"></div>/**\r
getEditor: function(rowIndex){\r
return this.editable !== false ? this.editor : null;\r
},\r
+ \r
+ <div id="method-Ext.grid.Column-setEditor"></div>/**\r
+ * Sets a new editor for this column.\r
+ * @param {Ext.Editor/Ext.form.Field} editor The editor to set\r
+ */\r
+ setEditor : function(editor){\r
+ if(this.editor){\r
+ this.editor.destroy();\r
+ }\r
+ this.editor = null;\r
+ if(editor){\r
+ //not an instance, create it\r
+ if(!editor.isXType){\r
+ editor = Ext.create(editor, 'textfield');\r
+ }\r
+ //check if it's wrapped in an editor\r
+ if(!editor.startEdit){\r
+ editor = new Ext.grid.GridEditor(editor);\r
+ }\r
+ this.editor = editor;\r
+ }\r
+ },\r
+ \r
+ destroy : function(){\r
+ this.setEditor(null);\r
+ },\r
\r
<div id="method-Ext.grid.Column-getCellEditor"></div>/**\r
* Returns the {@link Ext.Editor editor} defined for this column that was created to wrap the {@link Ext.form.Field Field}\r
* @return {Ext.Editor}\r
*/\r
getCellEditor: function(rowIndex){\r
- var editor = this.getEditor(rowIndex);\r
- if(editor){\r
- if(!editor.startEdit){\r
- if(!editor.gridEditor){\r
- editor.gridEditor = new Ext.grid.GridEditor(editor);\r
- }\r
- return editor.gridEditor;\r
- }else if(editor.startEdit){\r
- return editor;\r
- }\r
- }\r
- return null;\r
+ return this.getEditor(rowIndex);\r
}\r
});\r
\r