【问题标题】:ExtJS grid not showing store dataExtJS 网格不显示商店数据
【发布时间】:2014-09-06 20:52:12
【问题描述】:

我的 ExtJS Grid 没有显示我的商店数据。使用 ExtJS 5

这是我的网格(在 hbox 中):

{
    xtype: 'grid',
    title: 'Company Manager',
    id: 'companyGrid',
    flex: 1,
    plugins: 'rowediting',
    columnLines: true,
    store: Ext.data.StoreManager.lookup('companyStore'),
    columns: {
        items: [{
                header: 'ID',
                dataIndex: 'id',
            },
            {
                header: 'Name',
                dataIndex: 'name',
            },
            {
                header: 'Token',
                dataIndex: 'access_token'
            },
        ]
    }
}

这是我的商店(我使用 Sencha 的 Google 扩展程序,它充满了我的数据,所以这有效 + 结尾 });被编码块忽略):

var companyStore = Ext.create('Ext.data.Store', {
    storeId: 'companyStore',
    proxy: {
        type: 'ajax',
        url: 'resources/data/company.json',
        reader: {
            type: 'json',
            rootProperty: 'data'
        }
    },
    fields: [{
        name: 'id',
        type: 'int'
    }, {
        name: 'name',
        type: 'string'
    }, {
        name: 'access_token',
        type: 'string'
    }],
    autoLoad: true
});

有人知道我在这里出错了吗?

我已经尝试过:重新加载商店,检查商店是否真的被填满,刷新网格视图。

我尝试过没有任何效果,我决定向你们寻求建议:)

【问题讨论】:

  • 订单呢?与创建商店时相比,网格定义发生在哪里?

标签: javascript extjs grid jsonstore


【解决方案1】:

@Evan Trimboli

你让我思考,我摆弄了一秒钟,找到了以下解决方案。

而不是使用

store : Ext.data.StoreManager.lookup('companyStore'),

我用过

bind : '{companyStore}',

并将定义存储移至CompanyModel.js 文件:) 现在它可以正常工作了!!!!

谢谢:D

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-02
    • 2011-09-11
    • 2014-02-11
    • 2012-02-15
    • 2011-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多