我正在使用 ExtJs 4.0。我想读取图表中的 json 文件,但出现以下错误 Ext.Error: Unable to parse the JSON returned by the server: You're trying to decode an invalid JSON String.
店铺 n 型号:
Ext.define('chartModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'year'},
{name: 'comedy'},
{name: 'action'},
{name: 'drama'},
{name: 'thriller'}
]
});
var myStore = Ext.create('Ext.data.Store', {
model: chartModel,
proxy: {
type: 'ajax',
url : '/data.json',
reader: {
type: 'json',
root: 'data',
method: "GET",
messageProperty: 'jsonData'
}
},
autoLoad: true
});
data.json 文件:
data: [{year: 2005, comedy: 34000000, action: 23890000, drama: 18450000, thriller: 20060000}]