ExtJs:不显示存储数据

时间:2018-09-09 16:49:22

标签: javascript extjs single-page-application

我是ExtJ的新手,尝试了入门,但仍然很快就能解决问题。也许有人可以帮助我解决这个简单的例子。我无法可视化数据存储中的数据。面板和列工作正常,但没有数据。你发现我的错了吗?

Main.js:

Ext.define('QuickApp.view.main.Main', {
    extend: 'Ext.tab.Panel',

    xtype: 'tabpanel',
    items: [{
        title: 'Employee Directory',
        xtype: 'grid',
        iconCls: 'x-fa fa-users',
        store: 'QuickApp.store.Employee', //change here
        columns: [{
            text: 'First Name',
            dataIndex: 'firstName',
            flex: 1
        }, {
            text: 'Last Name',
            dataIndex: 'lastName',
            flex: 1
        }, {
            text: 'Phone Number',
            dataIndex: 'phoneNumber',
            flex: 1
        }]
    },{
        title: 'About Sencha',
        iconCls: 'x-fa fa-info-circle'
    }]
});

商店:

 Ext.define('QuickApp.store.Employee', {
    extend: 'Ext.data.Store',

    model: 'QuickApp.model.Employee',

    data: [{
        "firstName": "Jean",
        "lastName": "Grey",
        "officeLocation": "Lawrence, KS",
        "phoneNumber": "(372) 792-6728"
    }, {
        "firstName": "Phillip",
        "lastName": "Fry",
        "officeLocation": "Lawrence, KS",
        "phoneNumber": "(318) 224-8644"
    }, {
        "firstName": "Peter",
        "lastName": "Quill",
        "officeLocation": "Redwood City, CA",
        "phoneNumber": "(718) 480-8560"
    }]
 });

型号:

 Ext.define('QuickApp.model.Employee', {
    extend: 'Ext.data.Model',

    fields: [
        {name: 'firstName', type: 'string'},
        {name: 'lastName', type: 'string'},
        {name: 'officeLocation', type: 'int'},
        {name: 'phoneNumber', type: 'string'}
    ]
 });

谢谢!

0 个答案:

没有答案