1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Answers
    2
    Vote Rating
    1
    A.Tyshchyk is on a distinguished road

      0  

    Default Unanswered: Override config

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,227
    Answers
    3523
    Vote Rating
    859
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Overrides don't accept the config object
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    A.Tyshchyk is on a distinguished road

      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
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    447
    Answers
    21
    Vote Rating
    62
    suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough

      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
    A.Tyshchyk is on a distinguished road

      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
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    447
    Answers
    21
    Vote Rating
    62
    suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough

      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
    A.Tyshchyk is on a distinguished road

      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