Model Can';无法从存储中获取数据以显示为模型

Model Can';无法从存储中获取数据以显示为模型,model,sencha-touch,store,Model,Sencha Touch,Store,我对Sencha Touch有点陌生,所以请容忍我 在应用程序启动时,我将视口设置为我使用的视口,并将所有视图设置为应用程序名称空间 launch: function() { this.views.viewport = new this.views.Viewport(); this.views.homecard = this.views.viewport.getComponent('home'); this.views.usercard = thi

我对Sencha Touch有点陌生,所以请容忍我

在应用程序启动时,我将视口设置为我使用的视口,并将所有视图设置为应用程序名称空间

launch: function() {
        this.views.viewport = new this.views.Viewport();
        this.views.homecard = this.views.viewport.getComponent('home');
        this.views.usercard = this.views.viewport.getComponent('user');
        this.views.infocard = this.views.viewport.getComponent('info');
}
视口首先加载主视图,在这里我遇到了问题。 这是我的家庭卡:

ToolbarDemo.views.Homecard = Ext.extend(Ext.Panel, {
    title: "Meny",
    iconCls: "home",
    scroll: "vertical",
    bodyStyle: "background-color: #FFFFFF !important; background-image:                      url(images/background.png) !important; background-repeat:no-repeat; background-position:bottom left;",
    initComponent: function() 
    {
        ToolbarDemo.views.Homecard.superclass.initComponent.apply(this, arguments); 
    },
    store:ToolbarDemo.stores.feedStorer,
    tpl:buttonTemplate,
    dockedItems: 
    [
        {
        xtype: "toolbar"
        }
    ],
    defaults: {height: "110px"},

});
这是我的模板:

var buttonTemplate = new Ext.Template
(
    '<tpl for=".">',
    '   <div class="home_button_container">',
    '       <img class="home_button" src="{url_icon_large}" />',
    '       <p class="home_button_text">{name}</p>',
    '   </div>',
    '</tpl>'
);
这是我的商店:

ToolbarDemo.stores.feedStore = new Ext.data.Store({
    model: 'Feeds',
    storeId: 'feedStore',
    proxy: {
        type: 'scripttag',
        url : 'http://localhost/webservice/feeds.php?username=' + sUsername + '&password=' + sPassword,
        reader: {
            type: 'json',
            root: 'feeds'
        }
    },
    autoLoad: true
});
以下是JSON:

{“feeds”:[{“name”:“Links”,“url_icon_small”:“http:url/link_small.png”,“url_icon_medium”:“url/link_medium.png”,“url_icon_large”:“url/link_large.png”,“url”:“url/feed_content.php?type=link”,“sort_order”:“1”;“updated”:[{“上次更新”:“2011-06-09” 11:15:47“}]}

问题是这个视图没有显示任何内容,我怀疑模型可能有问题? 我已经记录了这个商店,我可以看到它得到了它应该得到的数据

有人提出了解决这个问题的建议吗

提前谢谢


编辑(获取有关DataView的提示): 外部面板更改:

ToolbarDemo.views.Homecard = new Ext.Panel({

    title: "Meny",
    iconCls: "home",
    scroll: "vertical",
    bodyStyle: "background-color: #FFFFFF !important; background-image: url(images/background.png) !important; background-repeat:no-repeat; background-position:bottom left;",
    initComponent: function() 
    {
        ToolbarDemo.views.Homecard.superclass.initComponent.apply(this, arguments); 
    },
    dockedItems: 
    [
        {
        xtype: "toolbar"
        }
    ],
    defaults: {height: "110px"},
    items: new Ext.DataView(
    {
        tpl:buttonTemplate,
        store: ToolbarDemo.stores.feedStorer,
        autoHeight:true,
        multiSelect: true,
        loadingText: 'Laster data',
        itemSelector:'div.home_button_container',
        emptyText: 'No images to display'
    })
});

这是当前设置为由
Ext.Dataview
而不是
Ext.Panel
处理的。任何继承表单
Ext.Component
的内容都可以传递
data
tpl
参数,并使主体加载将数据传递到tpl的结果


但是,您正在使用
存储
来处理未内置在
Ext.Panel
类中的数据。如果您转换为
Ext.Dataview
并定义所需的参数(当您尝试创建一个没有所有必要参数的视图时,它将抛出错误),那么您的模板/面板将正确显示。

Hi,谢谢您的回答。我试图将其更改为dataview,并按照我应该的方式提供tpl、store和itemSelector,但它一直给我错误消息:“未捕获的dataview要求定义tpl、store和itemSelector配置。”。我已经编辑了我的第一篇文章,所以您可以看到我所做的。您是否尝试将Ext.Dataview实例化中的tpl参数设置为空字符串?我不得不继续,所以我放弃了Dataview并尝试了其他方法
ToolbarDemo.views.Homecard = new Ext.Panel({

    title: "Meny",
    iconCls: "home",
    scroll: "vertical",
    bodyStyle: "background-color: #FFFFFF !important; background-image: url(images/background.png) !important; background-repeat:no-repeat; background-position:bottom left;",
    initComponent: function() 
    {
        ToolbarDemo.views.Homecard.superclass.initComponent.apply(this, arguments); 
    },
    dockedItems: 
    [
        {
        xtype: "toolbar"
        }
    ],
    defaults: {height: "110px"},
    items: new Ext.DataView(
    {
        tpl:buttonTemplate,
        store: ToolbarDemo.stores.feedStorer,
        autoHeight:true,
        multiSelect: true,
        loadingText: 'Laster data',
        itemSelector:'div.home_button_container',
        emptyText: 'No images to display'
    })
});