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

  • SEARCH
  • Home
  • 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 9195925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:44:12+00:00 2026-06-17T21:44:12+00:00

I use ExtJs 4.1 and DeftJs. Some class is defined with a constructor like

  • 0

I use ExtJs 4.1 and DeftJs.

Some class is defined with a constructor like that:

Ext.define( 'A.helper.Report', {
  config: {
     conf     : null,
     viewMain : null
  },
  constructor: function( oConfig ) {
     this.conf = oConfig.conf;
     this.viewMain = oConfig.viewMain;
     this.initConfig( oConfig );
  }
...

Now, I create several instances of this class like that:

var class1 = Ext.create( 'A.helper.Report', {
   conf: someValue,
   viewMain: someObject
} );

var class2 = Ext.create( 'A.helper.Report', {
   conf: otherValue,
   viewMain: otherObject
} );

When using these instances, although giving them different oConfig data, both class1 and class2 now have the data of the 2nd oConfig.

So when calling this.conf in both instances, I get someValue.

How can I keep the data of already created instances?


Solution:

I wrote

Ext.define( 'A.helper.Report', {
   ... 
  references: {}
  ...

and put my instances in there, overriding old instances.

Switched to references: null helped.

…

  • 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-06-17T21:44:14+00:00Added an answer on June 17, 2026 at 9:44 pm

    Be careful to not messing around with prototype objects…

    Rewritten answer

    You are doing it the wrong way.

    See this working JSFiddle

    Ext.define('A.helper.Report', {
         config: {
             conf     : null,
             viewMain : null
         },
         constructor: function(cfg) {
             this.initConfig(cfg);
         }
    });
    
    
    var class1 = Ext.create('A.helper.Report',{
        conf: 66,
        viewMain: 'Bear'
    });
    
    var class2 = Ext.create('A.helper.Report',{
        conf: 88,
        viewMain: 'Eagle'
    });
    
    class1.getConf(); // 66
    class1.getViewMain(); // Bear
    class2.getConf(); // 88
    class2.getViewMain(); // Eagle
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making use of the extjs class objects through Ext.define (... and Ext.create (...
I use extjs mvc and i define combobox Ext.define('Ext.view.Common.PersonageComboBox', { extend: 'Ext.form.ComboBox', alias: 'widget.PersonageComboBox',
I'd like to use the Ext.Element object interface from ExtJS to traverse an XML
I use ExtJs 4.1 and DeftJs. When using multiple instances of the same views
I use ExtJS 1.0.1 (in magento) I would like to get all checked nodes
I see that some of the examples included with ExtJS 4 start up via
I use extjs mvc and have a column that has renderer { text: __('Profiler.Personage.Settings.Active'),
I use the zh_CN locale in ExtJs (ExtJs 4.0), the default locale files that
I have a simple perl cgi that i use in my extjs project, written
I have an ExtJS grid like so: var grid = new Ext.grid.GridPanel({ ... });

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.