Extjs 3.4工具栏中的按钮呈现问题

Extjs 3.4 problems rendering buttons in toolbar

本文关键字:按钮 问题 工具栏 Extjs      更新时间:2023-09-26

使用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");
});

chrome控制台显示这个错误:

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

想法?

解决方案

在网格配置中添加一个存储:

store: new Ext.data.ArrayStore()

您缺少一个必需的配置选项store。错误是相关的,网格代码试图找出存储的排序状态,但它没有定义。