1. #1
    Ext User
    Join Date
    Nov 2007
    Posts
    6
    Vote Rating
    0
    qiuxy is on a distinguished road

      0  

    Exclamation PropertyGrid's problem?

    PropertyGrid's problem?


    I just wanna make the PropertyGrid read only, not allow editing
    how can I do it?

    I had try to use the Config Options,but is not available:

    defaults: {
    readOnly: true
    }

    and

    disableSelection: true

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    There's nothing built in to do it. You could try to override the isEditableValue fn to return false.

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2007
    Location
    Munich
    Posts
    30
    Vote Rating
    0
    sigaref is on a distinguished road

      0  

    Default


    I managed this by adding the last line in the code below somewhere after the grid code:
    Code:
    var grid = new Ext.grid.PropertyGrid({			  
    ...
    });
    // Some other code
    grid.startEditing = function(){   };

  4. #4
    Ext JS Premium Member
    Join Date
    Oct 2008
    Location
    California, USA
    Posts
    65
    Vote Rating
    2
    Supergibbs is on a distinguished road

      2  

    Default


    A slightly more elegant solution or if you only want some to be readonly add a beforeedit listener.

    To make all readonly:
    Code:
    listeners: { 'beforeedit': function (e) { return false; } }
    To make some:
    Code:
    listeners: {
                'beforeedit': function (e) {
                    switch (e.record.id) {
                        case 'readonly properties':
                            return false;
    
                        default:
                            return true;
    
                    }
                }
            }