Results 1 to 2 of 2

Thread: add / change config items during runtime

  1. #1
    Ext User
    Join Date
    Mar 2010
    Vote Rating

    Default add / change config items during runtime


    I would like to add {enableKeyEvent:true} to a Textarea during runtime, because it is not available by Designer's Component Config (yet ?).

    That leads me to the general question how to do this and similar actions with arbitrary components.

    1. I could insert the config params into MyContainer.ui.js - but it will be overwritten every time I export it.
    2. I tried it successfully whith th following code in MyContainer.js:

    MyContainer = Ext.extend(MyContainerUi, {
        initComponent: function() {
            MyFieldUi = Ext.override(Ext.form.TextArea, {
                enableKeyEvents: true,
                initComponent: function() {
            this.textfld.on('keypress', this.onkeypress, this);
        onkeypress: function(fld, e) {
            var k = e.getKey();
            alert("You just presssed "+k+", but why?");

    However, this will affect the whole class, I think, but not only the particular object instance.

    Please help me to figure out how to get it.

    Thanks in advance

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Vote Rating


    Ext.override will affect all instances of that class as you stated above.

    Also, currently you are running this within the initComponent portion of the code which will run everytime. You only need to run this once.

    You can add the enableKeyEvents within your subclass of the Ui class. (That doesn't get overwritten.)

    We'll get the enableKeyEvents configuration added in a nearby release.
    Aaron Conran

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts