標籤:extjs5 datastore
本文地址:http://blog.csdn.net/sushengmiyan/article/details/39031383
sencha官方API: http://docs.sencha.com/extjs/5.0/apidocs/#!/api/Ext.grid.Panel-cfg-store
本文sushengmiyan
------------------------------------------------------------------------------------------------------------------------------------
表格是現在web應用中常見的形式,而表格資料就是靈魂了,今天下班之後,短暫研究了下ext的表格。暫時琢磨出一點點東西來,先,後期再完善吧。
效果不是很理想:
還有點點報錯資訊,如下:
可以看到是layout導致的,將layout的boder方式登出,表格就可以正常顯示了:
這是官方例子顯示的效果,我這裡格式稍微有點點不大好看昂。
新增代碼如下:
{ xtype: 'panel',items:[{ xtype: 'gridpanel', //title: '表格面板', columns: [ { text: 'Name', dataIndex: 'name' }, { text: 'Email', dataIndex: 'email' }, { text: 'Phone', dataIndex: 'phone' }], store: Ext.create( 'Ext.data.Store', { //alias: 'paneldatastore', //storeId:'simpsonsStore', fields:['name', 'email', 'phone'], data:{'items':[{ 'name': 'Lisa', "email":"[email protected]", "phone":"555-111-1224" },{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },{ 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254" } ]}, proxy: {type: 'memory',reader: {type: 'json',rootProperty: 'items'}} }), renderTo: Ext.getBody()}] }
使用第十一節代碼,修改裡面Main.js內容,增加如上代碼,就可以研究datastore和datapanel了。
[ExtJS5學習筆記]第十四節 Extjs5中data資料來源store和datapanel學習