[ExtJS5學習筆記]第十五節 Extjs5表格顯示不友好?panel的frame屬性在作怪,extjs5frame

來源:互聯網
上載者:User

[ExtJS5學習筆記]第十五節 Extjs5表格顯示不友好?panel的frame屬性在作怪,extjs5frame

本文地址:http://blog.csdn.net/sushengmiyan/article/details/39057243

sencha官方API: http://docs.sencha.com/extjs/5.0/apidocs/#!/api/Ext.grid.Panel-cfg-store

本文作者:sushengmiyan

------------------------------------------------------------------------------------------------------------------------------------

Ext的官方例子顯示如下:


我寫的代碼,顯示出來的就是這個樣子?這是何原因?

為什麼我的Extjs中表格顯示不友好?panel的frame屬性在作怪


標題列沒有排序那些也沒有分隔條,下方的資料也是沒有分割,看起來很難受的。誰給看下癥候在哪?


代碼如下:

{            xtype: 'panel',region: 'center',//layout: { type: 'fit' },items:[{      xtype: 'gridpanel',  title: '表格面板',  columns: [                { text: 'Name',  dataIndex: 'name'  },                { text: 'Email', dataIndex: 'email' ,flex: 1 },                { text: 'Phone', dataIndex: 'phone' }],  store: Ext.create(  'Ext.data.Store',  { //alias: 'paneldatastore', //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',rootProperty: 'items'}}  }),}]      }

對比了官方提供的grid綁定xml檔案的例子,發現需要將panel的frame屬性設定為true。於是重新來試一下:


最終顯示效果如下:


最新代碼如下:

{            xtype: 'panel',frame: true,//加上frame屬性,表格顯示就友好了region: 'center',//layout: { type: 'fit' },items:[{      xtype: 'gridpanel',  title: '表格面板',  columns: [                { text: 'Name',  dataIndex: 'name'  },                { text: 'Email', dataIndex: 'email' ,flex: 1 },                { text: 'Phone', dataIndex: 'phone' }],  store: Ext.create(  'Ext.data.Store',  { //alias: 'paneldatastore', //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',rootProperty: 'items'}}  }),}]      }

原因:panel的frame屬性設定為true之後,就可以友好顯示表格了。




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.