【发布时间】:2012-04-15 04:05:04
【问题描述】:
我想要一个导航视图。我正在尝试使用 JsonP 代理填充 Sencha Touch 中的列表。
这是我迄今为止尝试过的示例代码 sn-p:
var view = Ext.define('MyApp.view.NavigateView', {
extend: 'Ext.navigation.View',
xtype:'navigateview',
config : {
fullscreen:true,
styleHtmlContent:true,
scrollable:true,
items : [
{
title:'Navigation',
items : [
{
xtype:'list',
store: {
fields : ['title','author'],
proxy : {
type:'jsonp',
url:'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog',
reader: {
type: 'json',
rootProperty: 'responseData.feed.entries'
}
},
autoLoad:true,
},
itemTpl:'<div class="contact">{title} <strong>{author}</strong></div>',
listeners : {
itemtap : function(){
Ext.Msg.alert('Called');
}
}
}
],
}
]
}
});
但问题是,我的列表没有被填充。列表中没有显示任何项目。
另外,我经常在控制台上收到此错误。
XMLHttpRequest 无法加载 http://api.tinyhippos.com/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=list.php%3F_dc%3D1334462633038%26page%3D1%26start%3D0%26limit%3D25。 Access-Control-Allow-Origin 不允许来源http://localhost。
有人请指导吗?我在这里缺少什么?
【问题讨论】:
-
看起来您的错误不在使用 jsonp 的 googleapis 提要中。您在哪里使用 tinyhippos.com,那应该是您的错误位置。
-
不,我不这么认为。当我提供用于 sencha 触摸图表而不是用于普通 sencha 触摸应用程序的“sencha-touch.css”文件时,我能够看到数据,但没有正确呈现。因此,数据即将到来,但未正确呈现。可能是什么原因?
-
但是如果你查看错误,它说 XMLHttpRequest 无法从 tinyhippo 加载某些东西,
标签: javascript list proxy extjs sencha-touch-2