网格在sencha touch 2

时间:2014-11-26 10:57:45

标签: javascript extjs grid sencha-touch

我是Sencha touch的新手,我喜欢通过编辑app.js文件在我的应用程序中集成网格 这是app.js

的包含
 Ext.application({
name: 'Sencha',

launch: function() {

    Ext.create('Ext.data.TreeStore', {
        storeId: 'TreeStore',
        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'
            }
        }
    });     
    Ext.create("Ext.tab.Panel", {
        fullscreen: true,
        tabBarPosition: 'bottom',

        items: [
            {
                xtype: 'nestedlist',
                title: 'Menu 1',
                iconCls: 'star',
                displayField: 'title',

                store: 'TreeStore',

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

                listeners: {
                    itemtap: function(nestedList, list, index, element, post) {
                        this.getDetailCard().setHtml(post.get('content'));
                    }
                }
            },
            {
                xtype: 'grid',
                title: 'GRID',
                requires: ['Ext.grid.Grid',
                   'Ext.grid.HeaderGroup',
                   'Ext.grid.plugin.Editable',
                   'Ext.grid.plugin.ViewOptions',
                   'Ext.grid.plugin.MultiSelection',
                   'Ext.grid.plugin.ColumnResizing',
                   'Ext.grid.plugin.SummaryRow'
                  ]
            }
        ]
    });
}

});

它显示了一个错误'未捕获的错误:[Ext.createByAlias]无法创建无法识别的别名实例:widget.grid' 有没有办法纠正这些错误或我的步骤是错误的?

提前谢谢

2 个答案:

答案 0 :(得分:2)

Sencha Touch Grid仅适用于Sencha Touch Complete(付费)产品。如果您还没有购买Sencha Touch Complete,则网格组件不可用。如果您有Touch Complete SDK,则可能是您的要求问题。需要不应该在一个项目中:[] config,它应该是类/文件顶部的需求。对于您的代码示例,它将位于应用程序配置本身下。

答案 1 :(得分:1)

看看

https://github.com/swluken/TouchTreeGrid

它可能会有所帮助,我在我的项目中使用过。

如上所述,Sencha Touch Grid仅在Sencha Touch Complete(付费)产品中可用,因此它在'toch'目录中不可用,因此当您尝试加载'Ext.grid.Grid'时会抛出错误

任何疑问......随便问。