Extjs 如何在sencha touch中显示列表中的数据

Extjs 如何在sencha touch中显示列表中的数据,extjs,sencha-touch,Extjs,Sencha Touch,我在容器中添加了一个列表,并将其与store和model连接起来。它获取数据并显示在列表中,但当我在设备上测试时,并没有显示任何内容 上面说商店是空的。我不知道如何在设备的列表中显示数据 请帮忙 我的商店:- Ext.define('AmericanBBQ.store.Recipe_Store', { extend: 'Ext.data.Store', requires: [ 'AmericanBBQ.model.r

我在容器中添加了一个列表,并将其与store和model连接起来。它获取数据并显示在列表中,但当我在设备上测试时,并没有显示任何内容

上面说商店是空的。我不知道如何在设备的列表中显示数据

请帮忙

我的商店:-

Ext.define('AmericanBBQ.store.Recipe_Store', {
            extend: 'Ext.data.Store',
            requires: [
                'AmericanBBQ.model.recipe',
                'Ext.data.proxy.Ajax',
                'Ext.data.reader.Json'
            ],

            config: {
                autoLoad: true,
                 autoSync: true,
                model: 'AmericanBBQ.model.recipe',
                storeId: 'Recipe_Store',
                proxy: {
                    type: 'ajax',
                    url: 'FetchRecipes?user_id=1',
                    reader: {
                        type: 'json',
                        rootProperty: 'Recipes'
                    }
                }
            }
        });
我的模型:-

Ext.define('AmericanBBQ.model.recipe', {
    extend: 'Ext.data.Model',

    requires: [
        'Ext.data.Field'
    ],

    config: {
        fields: [
            {
                name: 'course_name'
            },
            {
                name: 'cuisine_name'
            },
            {
                name: 'recipe_name'
            },
            {
                name: 'recipe_make_time'
            },
            {
                name: 'recipe_servings'
            },
            {
                name: 'recipe_tag_list'
            },
            {
                name: 'recipe_rating'
            },
            {
                name: 'recipe_likes'
            },
            {
                name: 'recipe_views'
            },
            {
                name: 'recipe_modification_date'
            },
            {
                name: 'recipe_id'
            },
            {
                name: 'recipes_img'
            }
        ]
    }
});
我的名单:-

Ext.define('AmericanBBQ.view.recipelst', {
    extend: 'Ext.dataview.List',
    alias: 'widget.mylist3',

    requires: [
        'Ext.XTemplate',
        'Ext.TitleBar',
        'Ext.Button'
    ],

    config: {
        height: 500,
        id: 'recipelst',
        itemId: 'recipelst',
        itemTpl: [
            '<div class="list-item">',
            '    <img class="photo" src="http://demo2.ongraph.com/demo/amrican/images/{recipes_img}" />',
            '    <h1>{recipe_name}</h1>',
            '    <span>Rating: {recipe_rating}</span>',
            '</div>'
        ],
        items: [
            {
                xtype: 'titlebar',
                docked: 'top',
                title: 'Recipe',
                items: [
                    {
                        xtype: 'button',
                        align: 'right',
                        id: 'add_recipe',
                        itemId: 'add_recipe',
                        text: 'Add'
                    }
                ]
            }
        ]
    }

});
Ext.Viewport.setActiveItem(Ext.create('AmericanBBQ.view.MainTabPanel'));
它在警报中给出错误:(无法在未定义时调用get)

以下是我如何显示我的列表:-

Ext.Viewport.setActiveItem(Ext.create('AmericanBBQ.view.MainTabPanel'));

您是否能够使用远程调试工具(Safari、Chrome和Firefox支持这些工具)?可能您的服务器发送了无效响应,或者您无法到达api端点。实际上,现在我可以使用jsonp请求获取存储中的数据。但无法将此存储绑定到列表。我使用此代码绑定到列表。var lst=Ext.createByAlias('widget.mylist3');一级设置存储(存储);Mh,试试这个:
Ext.create({xtype:'mylist3',store:store})
。您的方式似乎有点老土,您应该看看sencha touch的mvc和最佳实践指南。