PDA

View Full Version : invalid label error when loading json data in grid



jonesmc123
25 Nov 2007, 10:03 AM
I'm getting an invalid label error when this data payload is passed back on the store.load call:


{"total_records": 1, "records": [{"Agent.First Name": "David", "Agent.Annual Salary": 54000.0, "Agent.Last Name": "Carpenter"}]}


this is my reader/store setup:

store = new Ext.data.Store({
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.ScriptTagProxy({
url: 'http://127.0.0.1:5000/home/get_table_data/'
}),
//data: dummyData,
//reader: reader
// create reader that reads the data records
reader: new Ext.data.JsonReader({
root: 'records',
totalProperty: 'total_records',
fields: eval(field_defs)
})
});

where field_defs is actually:
"[{name: 'Agent.First Name' },{name: 'Agent.Last Name' },{name: 'Agent.Annual Salary' }]"

and my column model is:
cm: new xg.ColumnModel([
new xg.RowNumberer(),
{id:'Agent.First Name',header: "First Name", width: 110, sortable: true, dataIndex: 'Agent.First Name'},
{header: "Annual Salary", width: 90, sortable: true, dataIndex: 'Agent.Annual Salary'},
{header: "Last Name", width: 110, sortable: true, dataIndex: 'Agent.Last Name'}
])


if I change the store to use a local array and use the ArrayReader it works fine, but getting the remote data like above using the paging mechanism and calling store.load(...) fails with 'invalid label'

what am I doing wrong here? what does invalid label mean?

thanks,
Mark

25 Nov 2007, 2:14 PM
can you halt the use of periods in your names?