Results 1 to 8 of 8

Thread: Override config

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Answers
    2
    Vote Rating
    1
      0  

    Default Unanswered: Override config

    Is it possible to automatically generate getter and setter after the Class was defined?

    For example I want to do like this

    Code:
    Ext.define('Ext.SomeClass.override', {   
     override: 'Ext.SomeClass',
     config: {
            newProperty: null
     },
     applyNewProperty: function() {
     }
    }

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,331
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    Overrides don't accept the config object
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Answers
    2
    Vote Rating
    1
      0  

    Default

    I know it. I wonder if it is possible to do such a thing by another way. If it's not, it will be a good if you add such functionality in a new versions.

  4. #4
    Sencha Premium User suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    714
    Answers
    45
    Vote Rating
    234
      0  

    Default

    There's a bug logged with the development team regarding the ability to set config during an override.
    Handy when you want the new config available to subclass components which you don't get with extends.
    There is some debate about whether or not it is a legitimate use of override.

    You can get around it by using a mixin which is Senchas mechanism to achieve multiple inheritance.

  5. #5
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Answers
    2
    Vote Rating
    1
      0  

    Default

    I'm not exactly understood what you mean. I want to add to config new property. How I could do this without inheritance? Can you show an example?

  6. #6
    Sencha Premium User suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    714
    Answers
    45
    Vote Rating
    234
      0  

    Default

    Have a look at the API example -http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Class-cfg-mixins


    Create a mixin class (with the new config and behaviour), add it to the class you want the behavior and config for using the mixins config.

    Then where necessary use the config in the mixin by delegating to the mixin object.

  7. #7
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Answers
    2
    Vote Rating
    1
      0  

    Default

    I've read that. Good opportunity to multiple inheritance, but it's not what I need.
    The problem is that i can't set "mixins" property in override mechanism.
    I want to add functionality to sencha's base class Ext.field.Text.

  8. #8

Posting Permissions

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