Sencha Touch 2:'指定商店无法找到'

Lon*_*fPR 3 nested-lists sencha-touch-2

我正在尝试将JSON数据加载到NestedList中.我在/app/store/Exhibits.js中有以下商店文件

Ext.define('VisitTCMIndy.store.Exhibits',{
requires: ['VisitTCMIndy.model.Exhibit', 'Ext.data.proxy.JsonP'],
extend: 'Ext.data.TreeStore',
config: {
    model: 'VisitTCMIndy.model.Exhibit',
    proxy: {
        type: 'jsonp',
        url: 'http://www.example.com/explore.php',
        reader: {
            type: 'json',
            rootPropery: 'children'
        }
    }   
}
});
Run Code Online (Sandbox Code Playgroud)

然后我在/app/view/Explore.js中的以下视图中引用它

Ext.define('VisitTCMIndy.view.Explore', {
extend: 'Ext.Container',
requires: [
    'Ext.data.TreeStore',
    'Ext.dataview.NestedList',
    'VisitTCMIndy.store.Exhibits',
],
xtype: 'explorecard',
config: {
    iconCls: 'compass1',
    title: 'Explore',
    layout: 'fit',
    items: [
        {
            xtype: 'titlebar',
            docked: 'top',
            title: 'Explore'
        },
        {
            xtype: 'nestedlist',
            fullscreen: true,
            store: 'VisitTCMIndy.store.Exhibits',
            detailCard: {
                html: 'Explore Details'
            },
            listeners: {
                leafitemtap: function(nestedList, list, index, target, record){
                    var detailCard = nestedList.getDetailCard();
                    detailCard.setHtml('Exhibit Title: '+ record.get('title'));
                }
            }
        }

    ]
}
});
Run Code Online (Sandbox Code Playgroud)

当我转到页面时,我收到以下警告和一个空列表:

[WARN] [Ext.dataview.NestedList #applicationStore]找不到指定的Store

在我的生活中,我无法弄清楚我做错了什么.

Lon*_*fPR 5

好.原来我必须在我的app.js文件中声明我的商店和模型.然后根据它的名称引用我的商店而没有其余的类定义.所以,我在app.js文件中添加了以下内容:

models: ['Exhibit'],
stores: ['Exhibits'],
Run Code Online (Sandbox Code Playgroud)

然后,这是我更新的Explore.js视图文件.

Ext.define('VisitTCMIndy.view.Explore', {
extend: 'Ext.Container',
requires: [
    'Ext.data.TreeStore',
    'Ext.dataview.NestedList',
    'VisitTCMIndy.store.Exhibits',
],
xtype: 'explorecard',
config: {
    iconCls: 'compass1',
    title: 'Explore',
    layout: 'vbox',
    items: [
        {
            xtype: 'titlebar',
            docked: 'top',
            title: 'Explore'
        },
        {
            xtype: 'nestedlist',
            store: 'Exhibits',
            title: 'Museum Levels',
            displayField: 'title',
            detailCard: {
                html: 'Explore Details'
            },
            listeners: {
                leafitemtap: function(nestedList, list, index, target, record){
                    var detailCard = nestedList.getDetailCard();
                    detailCard.setHtml('<div style="text-align:center;margin:.5em;"><img src="'+record.get('image')+'" alt="'+record.get('title')+'" />'+
                        '<p style="text-align:left;">'+record.get('text')+'</p></div>'
                    );
                }
            },
            flex: 1
        }

    ]
}
});
Run Code Online (Sandbox Code Playgroud)

另外,请注意我将布局从fit更改为vbox.我不得不这样做,并给列表一个1的flex,以便列表实际显示它正在加载数据.