herrjeh42
herrjeh42

Reputation: 2793

Extjs / Sencha: Locking columns in Ext.grid.EditorGridPanel - possible/how?

I am trying to lock a couple of columns in Sencha's EditorGridPanel It should look like this but in an editable grid:

http://dev.sencha.com/deploy/ext-4.0.1/examples/grid/locking-grid.html

According to examples I found on the web it should work with "locked: true". Actually it does not.

Is my code broken or is the information just wrong? I am using ext.js 3.3.0

var grid = new Ext.grid.EditorGridPanel({
    title:'Editor',
    clicksToEdit: 1,
    enableColLock: true,
    store: store,
    columns: [
    {
        header: 'ID',
        width: 30,
        locked: true,
        sortable: true,
        dataIndex: 'id',
        hidden: true
    },
    ...

Upvotes: 1

Views: 6076

Answers (2)

herrjeh42
herrjeh42

Reputation: 2793

There is an example in the sources in examples/grid/locking-grid.html

You have to use a LockingColumnModel and the LockingGridView.

Upvotes: 1

mo-getter
mo-getter

Reputation: 156

If by "lock" you mean to make the column uneditable, you might be referring to the Column.editable config option:

{
    header: 'ID',
    width: 30,
    editable: false,
    sortable: true,
    dataIndex: 'id',
    hidden: true
}

You can also update this value programmatically via ColumnModel.setEditable( Number col, Boolean editable ) like this:

grid.getColumnModel().setEditable(0, false);

Upvotes: 3

Related Questions