我为一个带有 sencha touch 的移动应用程序项目工作,我的模型在检索信息时遇到了问题。我将向您展示我的模型和我的 json 文件内容
json文件:(我只是为了测试而变得非常简单,我删除了几何线)
{
"type": "FeatureCollection",
"features": [
{
"properties": {"graphic": "img/restaurant.png","Name": "Igor Tihonov", "Country":"Sweden", "City":"Gothenburg"}
}
]
}
我的模型:
Ext.regModel('Features', {
hasMany: {model: 'Properties', name: 'properties'}
});
Ext.regModel('Properties', {
fields: ['graphic', 'Name', 'Country', 'City'],
associations: [
{type: 'belongsTo', model: 'Features'}
]
});
店铺 :
Ext.data.Store({
model: 'Features',
proxy: {
type: 'ajax',
url : 'poi2.json',
reader: {
type: 'json',
rootProperty: 'features'
}
},
autoLoad:true
});
我被封锁已经一个多星期了,我希望你能帮助我!谢谢你