user1066183
user1066183

Reputation: 2584

Extjs 3.4 problems rendering buttons in toolbar

Using Extjs 3.4. I am creating a top Toolbar above a grid.

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

The chrome console show this error:

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

Ideas?

SOLUTION add a store in the grid config:

store: new Ext.data.ArrayStore()

Upvotes: 1

Views: 1819

Answers (1)

Saki
Saki

Reputation: 5856

You are missing a required configuration option store. The error is related, the grid code tries to find out sort state of the store but it is not defined.

Upvotes: 5

Related Questions