//Ext.create('Ext.data.Store', { // autoLoad: false, // storeId: 'simpsonsStore', // fields: ['name', 'email', 'phone'], // data: { // 'items': [ // { 'name': 'Lisa', "email": "lisa@simpsons.com", "phone": "555-111-1224" }, // { 'name': 'Bart', "email": "bart@simpsons.com", "phone": "555-222-1234" }, // { 'name': 'Homer', "email": "homer@simpsons.com", "phone": "555-222-1244" }, // { 'name': 'Marge', "email": "marge@simpsons.com", "phone": "555-222-1254" } // ] // }, // proxy: { // type: 'memory', // reader: { // type: 'json', // root: 'items' // } // } //}); Ext.define('Crm.store.retailClient.myClientStore', { extend: 'Ext.data.Store', autoLoad: false, storeId: 'myClientStore', fields: ['name', 'email', 'phone'], data: { 'items': [ { 'name': 'Lisa', "email": "lisa@simpsons.com", "phone": "555-111-1224" }, { 'name': 'Bart', "email": "bart@simpsons.com", "phone": "555-222-1234" }, { 'name': 'Homer', "email": "homer@simpsons.com", "phone": "555-222-1244" }, { 'name': 'Marge', "email": "marge@simpsons.com", "phone": "555-222-1254" } ] }, proxy: { type: 'memory', reader: { type: 'json', root: 'items' } } }); Ext.define('Crm.view.retailClient.myClient', { extend: 'Ext.grid.Panel', xtype: 'myClient', store: 'myClientStore', title: 'Basic Grid', columns: [ { text: 'Name', dataIndex: 'name', flex: 1 }, { text: 'Email', dataIndex: 'email', flex: 2 }, { text: 'Phone', dataIndex: 'phone', flex: 1 } ], listeners: { afterrender: { fn: function (grid) { var myStore = grid.getStore(); myStore.load(); console.info(myStore); } } } });
代码如上,我写了两种store的方式,注释的那种Create方式的可以正确显示数据,但是换成define的,死活出不来数据,连界面都挂了,一片空白,请教各位大神.....
网上找了一天实在是找不出来有什么不对头的.