View Full Version : [FIXED][2.x,3.x] PropertyColumnModel constructor uses DOM

22 Jun 2009, 12:37 AM
This is a really old bug, but I can't seem to find a bugreport for it.

Edit: I found it here (http://extjs.com/forum/showthread.php?t=25833) (note: I completely disagree with Jack!)

The PropertyColumnModel constructor accesses the DOM. This means that you can't create a PropertyGrid instance outside of Ext.onReady.


var propgrid = new Ext.grid.PropertyGrid({
title: 'PropertyGrid',
source: {
"Text": "Text",
"Number": 1,
"Boolean": true,
"Date": new Date()
new Ext.Viewport({
layout: 'fit',
items: propgrid
(fails with error 'el is null')

Suggested patch:

var proto = Ext.grid.PropertyColumnModel.prototype;
Ext.grid.PropertyColumnModel = function(grid, store){
this.grid = grid;
var g = Ext.grid;
g.PropertyColumnModel.superclass.constructor.call(this, [
{header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true},
{header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true}
this.store = store;
/*this.bselect = Ext.DomHelper.append(document.body, {
tag: 'select', cls: 'x-grid-editor x-hide-display', children: [
{tag: 'option', value: 'true', html: 'true'},
{tag: 'option', value: 'false', html: 'false'}
var f = Ext.form;
var bfield = new f.Field({
bselect : this.bselect,
autoShow: true,*/
autoCreate: {tag: 'select', children: [
{tag: 'option', value: 'true', html: 'true'},
{tag: 'option', value: 'false', html: 'false'}
getValue : function(){
return this.el/*bselect*/.value == 'true';
this.editors = {
'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),
'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),
'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),
'boolean' : new g.GridEditor(bfield)
this.renderCellDelegate = this.renderCell.createDelegate(this);
this.renderPropDelegate = this.renderProp.createDelegate(this);
Ext.extend(Ext.grid.PropertyColumnModel, Ext.grid.ColumnModel, proto);

22 Jun 2009, 2:25 AM
Fixed in SVN.