[ExtJS5學習筆記]第二十三節 Extjs5中表格gridpanel的列格式設定

來源:互聯網
上載者:User

[ExtJS5學習筆記]第二十三節 Extjs5中表格gridpanel的列格式設定

 

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

在使用表格的時候,我們預設都是載入一些文本文字,可是偶爾我們還有個人化的需求,比如我想增加一個選擇框,或者我需要一個日期的輸入。那麼這時候,就需要配置gridpanel的格式屬性了。

配置的時候遇到了這個錯誤:TypeError: headers[i].getCellWidth is not a function

我配置的代碼如下

 

    Ext.create('Ext.grid.Panel',  {        frame: true,    columnLines: true, // 加上表格線          selType: 'cellmodel',     dockedItems: [{  xtype: 'toolbar',  dock: 'top',  items: [{        xtype: 'label',                 text: '使用日期:',                      //glyph: 0xf016,                 //handler: 'addRecord',               },{        xtype: 'datefield', name: 'dateuse',     format: 'Y-m-d', submitFormat: 'Y-m-d'               },{                    text: '查看此段',                 listeners: {                     click: function() {                                                  alert('I was clicked!');                     },                  }               }]    }],renderTo: Ext.getBody(),        columns: [          { text: '車輛',  dataIndex: '車輛' },          { text: '選擇', dataIndex: '選擇', xtype: 'checkbox'},//這個地方想配置選擇框          { text: '星期一', dataIndex: '星期一' },  { text: '星期二', dataIndex: '星期二' },  { text: '星期三', dataIndex: '星期三' },  { text: '星期四', dataIndex: '星期四' },  { text: '星期五', dataIndex: '星期五' },  { text: '星期六', dataIndex: '星期六' },  { text: '星期日', dataIndex: '星期日' }        ],store: clxxStore}).show();

在配置選擇框的地方我配置的xtype為checkbox就出錯了。原因是對於gridpanel中的這個屬性,有單獨的組件配置:

 

所以想配置check的話就需要找到這個的別名chekcolunm

Ok.就這樣解決問題了。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.