• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Bug in extjs 6.2 textarea readOnly property

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug in extjs 6.2 textarea readOnly property

    Using Valence 5.1. Appears this goes back to Extjs4, someone reported to Sencha that property did not work in beta and Sencha posted as fixed. But appears what they fixed was just setting readOnly when defining the field. If you attempt to dynamically alter that property with down('#fieldname).readOnly = true/false it does not work. Only textarea, other field types work fine.

    I have yet to find a decent workaround to this on client side, if any of you have an idea please let me know. For now I'll just handle this server side, ignore updating those textareas if not in proper Valence security group.

    CNX, I've not seen anyone report this to Sencha when searching web. If you could do so would carry more clout from a Gold partner than a smuck like me. Thanks!

  • #2
    Hi Terry,

    You just need to use the setReadOnly method on the field. Here is an example Sencha Fiddle of it in action in 6.2. Thanks

    Code:
    Ext.application({
        name : 'Fiddle',
    
        launch : function () {
            Ext.application({
                name : 'Fiddle',
    
                launch : function () {
                    /**
                     * setReadOnly - set the text areas read only
                     * @param state - true/false
                     */
                    var setReadOnly = function (state) {
                        var textArea = Ext.ComponentQuery.query('#myTextArea')[0];
                        if (!Ext.isEmpty(textArea)) {
                            textArea.setReadOnly(state);
                        }
                    };
    
                    Ext.create('Ext.form.FormPanel', {
                        title       : 'TextArea Test ReadOnly',
                        width       : 400,
                        bodyPadding : 10,
                        renderTo    : Ext.getBody(),
                        items       : [{
                            xtype      : 'textareafield',
                            grow       : true,
                            name       : 'message',
                            fieldLabel : 'Message',
                            anchor     : '100%',
                            itemId     : 'myTextArea'
                        }],
                        buttons     : [{
                            text    : 'Read Only',
                            handler : function () {
                                setReadOnly(true);
                            }
                        }, {
                            text    : 'Not Read Only',
                            handler : function () {
                                setReadOnly(false);
                            }
                        }]
                    });
                }
            });
    
        }
    });

    Comment


    • #3
      SOB. I actually tried that, Johnny, and it didn't work either. But it is now. I must have had a typo in the capitalization or something. Doesn't make sense the other method works for everything but textarea but I can live with this. Thanks so much!

      Comment

      Working...
      X