user3203030
user3203030

Reputation: 75

Disabling entire column in extjs 4.2.1

I have a simple grid of multiple columns and each column editable fields. When I call column.disable() only the header of the column is getting disabled and the fields in the column are still editable. How can I disable all the fields in the column ?

Upvotes: 1

Views: 666

Answers (2)

herme 0
herme 0

Reputation: 972

in combination with the beforeedit event handler, you can use a renderer to alter the tdStyle of the cell to indicate it is disabled:

renderer: function(value, meta, record, rowIdx, colIdx, store, view) {
    var column = this.getHeaderContainer().getHeaderAtIndex(colIdx);
    if (column.disabled) {
        meta.tdStyle = "opacity: 0.4;";
    }

    return value;
}

tdCls is even better and allow more fine tuning of the appearance.

Upvotes: 1

pvlt
pvlt

Reputation: 1863

You must call disable method after render your editor. I use beforeedit event for disable my fields For example:

beforeedit: function (editor, context) {
    ...
    editor.editor.down('onetomanyeditor').disable()
    ...
},

Upvotes: 1

Related Questions