Javascript ExtJs:store的数据是';t显示
我是ExtJs新手,尝试了入门,但仍然很快就遇到了问题。也许有人能帮我举个简单的例子。我无法想象数据存储的数据。面板和列工作正常,但没有数据。你发现我的错误了吗 Main.js:Javascript ExtJs:store的数据是';t显示,javascript,extjs,single-page-application,Javascript,Extjs,Single Page Application,我是ExtJs新手,尝试了入门,但仍然很快就遇到了问题。也许有人能帮我举个简单的例子。我无法想象数据存储的数据。面板和列工作正常,但没有数据。你发现我的错误了吗 Main.js: Ext.define('QuickApp.view.main.Main', { extend: 'Ext.tab.Panel', xtype: 'tabpanel', items: [{ title: 'Employee Directory', xtype: '
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'}
]
});
谢谢 你能做一把小提琴吗?在第一个视图中,对我来说,存储似乎没有正确创建-您可以使用Ext.getCmp('Grid-Cmp-ID').getStore()进行调试。您是对的!我必须将行(见注释)更改为“store:Ext.create('QuickApp.store.Employee'),“谢谢!