简体   繁体   English

ExtJS网格未显示商店数据

[英]ExtJS grid not showing store data

My ExtJS Grid is not showing my store data. 我的ExtJS网格未显示我的商店数据。 Using ExtJS 5 使用ExtJS 5

This is my grid (it's within a hbox): 这是我的网格(在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'
            },
        ]
    }
}

This is my store (I use the Google Extension of Sencha and it's filled with my data so this works + the ending }); 这是我的商店(我使用的是Sencha的Google扩展程序,并且其中充满了我的数据,因此可以使用+结束符}); were ignored by the coding block): 被编码块忽略了):

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
});

Does anyone know were I went wrong here? 有人知道我在这里错了吗?

I have tried: Reloading the store, checking if the store is actually filled, refreshing the grid view. 我已经尝试过:重新加载商店,检查商店是否实际装满,刷新网格视图。

Nothing I tried worked and I decided to ask you guys for advice :) 我没有尝试任何工作,所以我决定向大家寻求建议:)

@Evan Trimboli @埃文·特里波利

You made me think and I fiddled arround for a second and found the following solution. 您让我想了想,我拨弄了arround一秒钟,找到了以下解决方案。

Instead of using the 而不是使用

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

I used 我用了

bind : '{companyStore}',

And moved the define store towards the CompanyModel.js file :) now it works properly!!!! 并将定义存储移向CompanyModel.js文件:)现在可以正常使用了!!!!

Thanks :D 感谢:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM