1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    12
    Vote Rating
    0
    masm is on a distinguished road

      0  

    Default Answered: How to pass parameters to inherited custom component?

    Answered: How to pass parameters to inherited custom component?


    For instance I have following base class:
    Code:
    Ext.define('MyCompany.BaseClass', {
        extend: 'Ext.panel.Panel',
    
        // This field I want to initialize
        customField: '',
    
        initComponent: function() {
            this.callParent(arguments);
        }
    });
    And custom derived class:
    Code:
    Ext.define('MyCompany.SubClass', {
        extend: 'MyCompany.BaseClass',
    
        initComponent: function() {
            this.callParent(arguments);
        }
    });
    And then I try to create an instance of subclass with passing a parameter to initialize 'customField':
    Code:
    Ext.create('MyCompany.SubClass', {
        customField: 'Test'
    });
    Where is appropriate place to catch passed parameter in the class hierarchy and initialize necessary field?

  2. In initComponent you should be able to access your customField via this.customField.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,678
    Answers
    3355
    Vote Rating
    749
    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


    In initComponent you should be able to access your customField via this.customField.
    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.

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    12
    Vote Rating
    0
    masm is on a distinguished road

      0  

    Default


    I've tried access it via 'arguments', didn't know that it can be accessed directly. 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