0
我有以下的模型,ExtJS Store加載不正確?
Ext.define('Forecaster.model.WeatherDay', {
extend : 'Ext.data.Model',
fields : [
{
name : 'version',
type : 'string',
mapping : 'version'//'forecast.simpleforecast.forecastday.date.pretty'
}
]
});
正在使用由下列存儲
:
Ext.define('Forecaster.store.WeatherDay', {
extend : 'Ext.data.Store',
model : 'Forecaster.model.WeatherDay',
autoLoad : true,
proxy : {
type : 'jsonp',
method : 'GET',
url : 'http://api.wunderground.com/api/[apiKEY]/forecast10day/q/11432.json',
reader : {
type : 'json',
rootProperty : 'response'
}
}
});
但存儲爲空。當我做到以下幾點:
console.log(store.getProxy().getReader().rawData);
以下是打印出來(所以店裏正在接收數據):
對應於以下JSON,我接受:
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"forecast10day": 1
}
}
,
"forecast":{
"txt_forecast": {
"date":"5:18 PM EDT",
"forecastday": [
{
"period":0,
"icon":"cloudy",
"icon_url":"http://icons.wxug.com/i/c/k/cloudy.gif",
...more of the response...
因爲我清楚地接收到數據但商店是空的(getCount()返回0),我在映射到模型階段時做了什麼錯誤?