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

      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
    38,402
    Vote Rating
    1103
    Answers
    3681
    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 Software Engineer
    ________________
    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
    Vote Rating
    1
    Answers
    2
    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
    680
    Vote Rating
    226
    Answers
    45
    suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold

      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
    Vote Rating
    1
    Answers
    2
    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
    680
    Vote Rating
    226
    Answers
    45
    suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold suzuki1100nz is a splendid one to behold

      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
    Vote Rating
    1
    Answers
    2
    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