PDA

View Full Version : this.reader is undefined



bauchinj
18 Oct 2009, 10:59 PM
var myData = [
['abcd','EF','GH','test@home.com']
];

var st = new Ext.data.Store({
fields : [{
name : 'id'
},{
name : 'first'
},{
name : 'last'
},{
name : 'email'
}
]
});

ctrContainer.add({
xtype : 'grid',
title : 'param',
region : 'center',
store : st,
columns : [{
id :'id',
header : "UUID",
width : 160,
sortable : false,
dataIndex : 'id'
},{
header : "First",
width : 75,
sortable : true,
dataIndex : 'first'
},{
header : "Last",
width : 75,
sortable : true,
dataIndex : 'last'
},{
header : "Email",
width : 75,
dataIndex : 'email'
}
]
});
st.loadData(myData);

So, when I run this script, I get the error in headline!
I want to load this gridpanel in borderLayout region: center! Just the Grid without data is load. the error is thrown in line "st.loadData..."
I read the API, there is also an examle like my store, so I really don't know, what's the problem now!


rgds

adibhagra
18 Oct 2009, 11:05 PM
you haven t specified the reader within your store config

bauchinj
18 Oct 2009, 11:07 PM
How can I do this? I don't can read it in the API

Condor
18 Oct 2009, 11:09 PM
Looking at your data, I assume you want to use an ArrayReader.

You can also use an ArrayStore instead of a Store (automatically creates an ArrayReader from the specified fields).

bauchinj
18 Oct 2009, 11:16 PM
thank you very much!

Mike Robinson
19 Oct 2009, 7:21 AM
You've got to be using a debugger such as Firebug.

Assuming that you do, then always remember "the JavaScript programmer's swear-words: "what in the hell is this?!" :)

In other words, you will find yourself fairly-constantly beset with situations where the variable this does not refer to what you think it ought to . . .

In your case, "you just forgot something." But in the more frequent case, you'll find that you did specify the source-code as you intended to, but one of the following has happened:


"this" does not point to where you thought it would.
When the object was initialized, the attribute setting was somehow "undefined."
Both of the above. :-?
Or the other "JavaScript swear-word" ... "$@!$%#$%!! case-sensitivity!"