View Full Version : Error with simple grid app: this.config[a] is undefined

26 Mar 2011, 6:00 PM
I'm trying to write a very simple grid. My code so far is:


var grid = new Ext.grid.GridPanel
title: 'Basic Grid Panel with Ext JS and PHP',
renderTo: document.body,
width: 600,
height: 300,
frame: true,
autoExpandColumn: 'name',
style: 'margin: 30px auto',

store: new Ext.data.JsonStore({
// store configs
autoLoad: true,
url: '/chat/rooms/list',

// reader configs
root: 'rooms',
fields: ['name', 'title']

colModel: new Ext.grid.ColumnModel({
defaults: {
width: 120,
sortable: true
columns: [
{header: 'Name', dataIndex: 'name'},
{header: 'title', dataIndex: 'title'},

My json is:

{"rooms": [{"public": true, "name": "support", "title": "Support Room"}]}

I'm getting errors:

this.config[a] is undefined
swfobject(a=-1)ext-all.js (line 11)
swfobject(b=true)ext-all.js (line 11)
swfobject()ext-all.js (line 11)
swfobject(d=Object { dom=, id="ext-gen3", more...}, a=null)ext-all.js (line 11)
DomHelper(b=body#ext-gen3., a=undefined)ext-all.js (line 7)
DomHelper(b=Object { title="Basic Grid Panel with Ext JS and PHP", renderTo=, more...})ext-all.js (line 7)
apply()ext-base.js (line 7)
apply()ext-base.js (line 7)
apply()ext-base.js (line 7)
apply()ext-base.js (line 7)
(?)()rooms.js (line 33)

I'm sure I'm making a very silly mistake but I just can't see it. Any suggestions appreciated.


27 Mar 2011, 4:57 AM
The problem is that you're using the autoExpandColumn config option but haven't given the column an id - autoExpandColumn is based on 'id' not 'dataIndex'/'header'. Change the colModel to:

// ...
columns: [
{id: 'name', header: 'Name', dataIndex: 'name'},
// ...

Two other things:

1. Watch for trailing commas. This will work in FF, but fail in IE:

columns: [
// ...
{header: 'title', dataIndex: 'title'}, // <-- remove the comma

2. While developing/debugging, use ext-all-debug.js - it'll give you a much better idea of where your error occurs. (Additionally, use Firefox + Firebug, or IE + Firebug Lite - again for better error reporting.)

27 Mar 2011, 12:08 PM
Of course - thanks! That fixed it nicely.