我正在尝试使用 EXT JS 4、Sencha Touch 2.0 和 WebORB。
我正在尝试通过 Ext 动态地在 Sencha Touch 的 MVC 中建立一个商店。我在 Index.html 的部分中调用了以下 javascript 函数,如下所示:
<script src="sencha-touch-all.js"></script>
<script src="webORB.js"></script>
<script>
var dataFetched;
var dataGet=function(){
<!-- Class Name and URL are replaced in the original program-->
this.proxy = webORB.bind("ClassName", "URL");
dataFetched=this.proxy.GetClassList(1301722);
//console.log(dataFetched);
}
</script>
<script src="app.js">
</script>
以下是我的app.js
Ext.Loader.setConfig({
enabled: true
});
Ext.application({
name: 'SBR',
controllers: [
'Main','Blog','Comments'
],
views : [
'Home','Blog', 'Comments'
],
models : ['Comments'],
stores: ['Comments'],
launch: function(){
dataGet();
console.log(dataFetched);
Ext.create('SBR.view.Viewport');
}
});
以下是我的 Comment.js - 商店
Ext.define('SBR.store.Comments',{
extend: 'Ext.data.Store',
config: {
model: 'SBR.model.Comments',
data: dataFetched
}
});
以下是 Comment.js - 模型
Ext.define('SBR.model.Comments',{
extend: 'Ext.data.Model',
config: {
//fields: ['subject','body']
fields: ['bookImageUrl','authorFirstName','authorLastName']
}
})
以下是 Comment.js - 查看
Ext.define('SBR.view.Comments',{
extend: 'Ext.List',
xtype: 'commentspage',
config:{
title: 'Comments',
iconCls: 'star',
//indexBar: true,
store : 'Comments',
itemTpl: '{authorLastName}',
onItemDisclosure: function(item) {
console.log('Disclose more info on' + " " + item.data.subject);
}
}
});
如果我使用静态 Json Data 定义存储,它工作正常,但是当我尝试使用 WebORB 访问它时它不会。
控制台条目在向控制台显示数据之前完成。为什么它没有在评论视图中显示任何数据,或者我的方法通过 WebORB 收集和加载数据到商店是完全错误的?