Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read only PropertyGrid

Tags:

extjs

extjs4

Is there a way to make an ExtJS4 PropertyGrid (Ext.grid.property.Grid) non-editable?

There is no "editable" or "readonly" config option AFAICS.

like image 718
Rob Agar Avatar asked May 29 '26 01:05

Rob Agar


2 Answers

Another solution is to add a listener, that prevents starting the editing component:

    listeners: {
        'beforeedit': {
            fn: function () {
                return false;
            }
        }
    }

The problem with this solution is, that one can not mark a cell to copy (Ctrl+C) the contents.

like image 177
ChrisLo Avatar answered Jun 01 '26 04:06

ChrisLo


Use the sourceConfig to set the editor to a Ext.form.DisplayField:

Ext.create('Ext.grid.PropertyGrid', {
    sourceConfig: {
        field1: {
            displayName: 'Editable Field'
        },
        field2: {
            displayName: 'Readonly Field',
            editor: Ext.create('Ext.form.DisplayField')
        }
    },
    source: {
        field1: "Some property",
        field2: "Some other property",
    }
});
like image 37
Supergibbs Avatar answered Jun 01 '26 02:06

Supergibbs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!