我正在尝试在使用 Phonegap 和 Sencha touch2 进行编程时如何从服务器获取数据。
我正在尝试从 Google Weather API 获取一些天气数据。
我有一个带有列表的面板,现在应该显示 day_of_week 数据。但我找不到如何从属性中获取数据。如果您查看http://www.google.com/ig/api?weather=zonhoven上的 xml,您可以看到星期几表示为:
所以我得到了以下代码:
Ext.define('WeerBe.view.mainTabs.TestPage', {
extend : 'Ext.navigation.View',
xtype : 'testPage2',
config : {
title : 'Test Page2',
iconCls : 'info',
scrollable : true,
items : [{
xtype : 'list',
itemTpl: '{day_of_week}',
store : {
autoLoad: true,
fields : ['day_of_week'],
proxy : {
type : 'ajax',
url : 'http://www.google.com/ig/api?weather=zonhoven',
reader : {
type : 'xml',
root : 'weather',
record: 'forecast_conditions'
}
}
}
}]
}
})
列表应该包含 4 条记录,但它不显示数据,因为 day_of_week 节点本身是空的并且数据在 data 属性中。
如何获取属性数据?