2013-08-20 95 views
0

我是新來的extjs,我想添加一個複選框到我的container.viewport gridpanel。Extjs將複選框添加到container.viewport

這是我的代碼:

         xtype: 'gridpanel', 
             flex: 2, 
             autoScroll: true, 
             title: 'title', 
             store: 'OutgoingDataStore', 

             columns: [ 
              { 
               xtype: 'gridcolumn', 
               align: 'right', 
               dataIndex: 'calls_m', 
               text: 'Calls Monthly' 
              }, 
              { 
               xtype: 'checkcolumn', 
               align: 'right', 
               dataIndex: 'check', 
               text: 'check', 

              }.. 

沒有checkcolumnit工作正常,但是當我將其添加應用程序顯示空白頁面,並在控制檯上,我看到:「遺漏的類型錯誤:無法調用‘的子’ undefined'

回答

1

這取決於你使用的是什麼版本。在4.2.0中,CheckColumn被移入核心庫。如果你使用的是早期版本(看起來像你),那麼CheckColumn只是一個擴展,所以你需要從examples/ux文件夾中包含它。

0

在4.2.0中,你會這樣做。

xtype: 'gridpanel', 
    flex: 2, 
    autoScroll: true, 
    title: 'title', 
    store: 'OutgoingDataStore', 
    selModel: Ext.create('Ext.selection.CheckboxModel'), // This will add check column 
    columns: [ 
     { 
      xtype: 'gridcolumn', 
      align: 'right', 
      dataIndex: 'calls_m', 
      text: 'Calls Monthly' 
     } 
    ...