1. #1
    Sencha User Dumas's Avatar
    Join Date
    Dec 2008
    Location
    Vienna, Austria
    Posts
    564
    Answers
    4
    Vote Rating
    8
    Dumas is on a distinguished road

      0  

    Default Answered: Class System: A mixin constructor

    Answered: Class System: A mixin constructor


    Hello,

    how can I have a mixin constructor to augment the class instance?

    This does not work:
    PHP Code:
    Ext.define('MyApp.mixin.Test', {
        
    extend'Ext.mixin.Mixin',
        
    constructor: function(config) {
            
    console.info('mixin constructor called');
            
    this.initConfig(config);
        }
    });

    Ext.define('MyApp.TestClass', {
        
    mixins: ['MyApp.mixin.Test'],
        
    constructor: function(config) {
            
    console.info('test class constructor called');
            
    this.initConfig(config);
        }
    });

    Ext.create('MyApp.TestClass'); 
    Thanks,
    Roland

  2. You have to call the mixin's constructor manually. It isn't automatic because there's no way for the class system to know when to call it.

    There's an example of this at the top of the docs for Observable:

    http://docs.sencha.com/ext-js/4-1/#!...til.Observable

  3. #2
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Answers
    498
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    You have to call the mixin's constructor manually. It isn't automatic because there's no way for the class system to know when to call it.

    There's an example of this at the top of the docs for Observable:

    http://docs.sencha.com/ext-js/4-1/#!...til.Observable

  4. #3
    Sencha User Dumas's Avatar
    Join Date
    Dec 2008
    Location
    Vienna, Austria
    Posts
    564
    Answers
    4
    Vote Rating
    8
    Dumas is on a distinguished road

      0  

    Default


    Ok, thanks

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar