2014-07-11 89 views
0

使用Extjs 3.4。我正在網格上方創建一個頂級工具欄。Extjs 3.4工具欄中渲染按鈕的問題

Ext.onReady(function() { 
    var colModel = new Ext.grid.ColumnModel({ 
     columns: [{ 
      header: "Sottogruppo",dataIndex: 'some' 
     }], 
     defaults: { 
      width: 50, 
      sortable: false 
     } 
    }); 

    var saveButton = new Ext.Button({text: "Salva",id: 'save'});  

    var tbar = new Ext.Toolbar({items: [saveButton]}); 

    var grid = new Ext.grid.EditorGridPanel({ 
     colModel: colModel, 
     tbar: tbar 
    }); 
    grid.render("grid"); 
}); 

鉻控制檯顯示此錯誤:

Uncaught TypeError: Cannot read property 'getSortState' of undefined ../JS/ext-3.3.1/ext-all-debug.js 

想法?

SOLUTION 添加網格配置商店:

store: new Ext.data.ArrayStore() 

回答

4

你缺少必要的配置選項store。錯誤是相關的,網格代碼試圖找出商店的排序狀態,但它沒有被定義。

+0

我已經添加了一個商店,現在它的作品。 store:new Ext.data.ArrayStore() – user1066183