Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6657147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:43:54+00:00 2026-05-26T01:43:54+00:00

When should I be using initComponent compared to constructor ? I have been using

  • 0

When should I be using initComponent compared to constructor ?

I have been using initComponent to extend my objects, but looking at the docs for Ext.define is see them using constructor all over then place. what is the difference?

compare:

Ext.define('My.app.PanelPart2', {
    extend: 'My.app.Panel',
    constructor: function (config) {
        this.callSuper(arguments); // calls My.app.Panel's constructor
        //...
    }
});

to

Ext.define('My.app.PanelPart2', {
    extend: 'My.app.Panel',
    initComponent: function (config) {
        Ext.apply(this, config);
        this.callParent(arguments);
    }
});

I am aware of the fact that some components don’t init ( Im looking at you Ext.data.Store ), which leads me towards leaning towards only over writing the constructor, as that should be universal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:43:55+00:00Added an answer on May 26, 2026 at 1:43 am

    constructor is OOP standard for initializing objects instances and is available in every ExtJS class (everything created by Ext.define).

    initComponent is ExtJS extension for initializing components – classes that extends Ext.Component. It uses templated method pattern and enables some standard initialization steps before and after your custom component init. Something like this:

    Ext.Component.constructor() {
        - init events
        - apply config
        - create plugins
        - ...
        - your custom component initialization (initComponent)
        - ...
        - init plugins
        - etc.
    }
    

    My best pratices are to use initComponent whenever I’m creating custom component and constructor only for generic classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is my array, I think i should be using usort but i have
I have heard that I should avoid using 'order by rand()', but I really
I read in the docs that one should avoid using finish() - but I
Right, perhaps I should be using the normal Python lists for this, but here
I think i should be using selectors (or even a different paradigm), but even
I have just started evaluating whether or not I should be using OData influenced
I found that I should be using Reset CSS file for making websites, but
I've always been curious of which method of SQL joining I should be using.
I've got a big problem with encoding. The code I'm using should work but
Is there a specific reason why I should be using the Html.CheckBox , Html.TextBox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.