【发布时间】:2012-05-09 18:47:44
【问题描述】:
我正在试验如何在使用 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 属性中。
如何获取属性数据?
【问题讨论】:
标签: xml cordova sencha-touch-2