Sencha touch 2 空嵌套列表显示

Sencha touch 2 空嵌套列表显示,sencha-touch-2,nested-lists,Sencha Touch 2,Nested Lists,据了解,基于新创建的Sencha Touch 2应用程序。 然后我想添加我的嵌套列表-层次菜单树,并发现这并不重要-我的存储内联或我的存储从json读取-选项卡“菜单”中没有显示任何内容。 怎么了 重要文件/代码片段: app.js中的MVC部分: // MVC views: [ 'Main' ], models: [ 'MenuItem' ], stores: [ 'MenuTree' ], vi

据了解,基于新创建的Sencha Touch 2应用程序。 然后我想添加我的嵌套列表-层次菜单树,并发现这并不重要-我的存储内联或我的存储从json读取-选项卡“菜单”中没有显示任何内容。 怎么了

重要文件/代码片段:

app.js中的MVC部分:

// MVC
    views: [
        'Main'
    ],
    models: [
        'MenuItem'
    ],
    stores: [
        'MenuTree'
    ],
view.Main.js:

Ext.define('MobilePost.view.Main', {
    extend: 'Ext.tab.Panel',
    xtype: 'main',
    requires: [
        'Ext.TitleBar',
        'Ext.data.TreeStore',
        'Ext.dataview.NestedList',
        'Ext.data.proxy.JsonP',
        'MobilePost.store.MenuTree'
    ],

    config: {
        tabBarPosition: 'bottom',

        items: [
            {
                            // From tutorial, working
                title: 'Home',
                iconCls: 'home',
                cls: 'home',
                html: [
                    '<img src="http://staging.sencha.com/img/sencha.png" />',
                    '<h1>Welcome to Sencha Touch</h1>'
                ].join("")
            },
            {
                            // From tutorial, working
                xtype: 'nestedlist',
                title: 'Blog',
                iconCls: 'star',
                displayField: 'title',

                store: {
                    type: 'tree',

                    fields: [
                        'title', 'link', 'author', 'contentSnippet', 'content',
                        { name: 'leaf', defaultValue: true }
                    ],

                    root: {
                        leaf: false
                    },

                    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'
                        }
                    }
                },

                detailCard: {
                    xtype: 'panel',
                    scrollable: true,
                    styleHtmlContent: true
                },

                listeners: {
                    itemtap: function( nestedList, list, index, element, post ) {
                        this.getDetailCard().setHtml(post.get('content'));
                    }
                }
            },
            {
                            // Mine, not working
                xtype: 'nestedlist',
                title: 'Menu',
                iconCls: 'settings',
                store: 'MenuTree'
            }
        ]
    }
});
Store-Store.MenuTree.js:

Ext.define('MobilePost.store.MenuTree', {
    extend: 'Ext.data.TreeStore',

    requires: [ 'MobilePost.model.MenuItem' ],

    type: 'tree',
    defaultRootProperty: 'items',
    config: {
        model: 'MobilePost.model.MenuItem',
        /*
        // TODO: inline store - uncomment to use
        root: {
            items: [
                {
                    id: 'settings',
                    text: 'Settings',
                    items: [
                        {
                            id: 'shift',
                            text: 'Working shift',
                            leaf: true
                        },
                        {
                            id: 'users',
                            text: 'Users',
                            leaf: true
                        },
                        {
                            id: 'cash',
                            text: 'Cash',
                            leaf: true
                        }
                    ]
                }
            ]
        }*/
        // TODO: JSON store - comment for inline store
        proxy: {
            type: 'ajax',
            url: 'menu.json'
        }
    },
    // TODO: JSON store - comment for inline store
    root: {}
});
JSON-menu.JSON(有效,通过jsonlint.com检查):


您的存储在什么时候加载?您不应该在您的商店中使用
自动加载:true

此外,如果您不想使用应用程序加载创建和加载存储,则应在需要时手动创建存储,并将其设置为“列表”

var treeStore = Ext.create('MobilePost.store.MenuTree');
treeStore.load();
并将其用作视图中的存储属性

        {
            // Mine, not working
            xtype: 'nestedlist',
            title: 'Menu',
            id: 'myListId',
            iconCls: 'settings',
            store: treeStore
        }
或者,如果已创建视图,则设置存储

Ext.getCmp('myListId').setStore(treeStore);

Sencha Architect 2帮助我了解问题所在:1。自动加载:对于所需的存储,为true。2.需要存储的storeId声明。3.nestedlist中的store字段应精确指向以前声明的storeId。这就是全部。非常感谢你的帮助
        {
            // Mine, not working
            xtype: 'nestedlist',
            title: 'Menu',
            id: 'myListId',
            iconCls: 'settings',
            store: treeStore
        }
Ext.getCmp('myListId').setStore(treeStore);